il Mon, 28 Jul 2003 00:15:14 -0500, Tom Felker <tcfelker / mtco.com> ha
scritto::


>In practice, in GC'd languages, objects need to manage their non-memory
>resources (like open file descriptors) differently.  In C++ the resources
>are freed when the object is destroyed.  In Ruby, it's typical to make a
>function that allocates, yields, and frees.

well, the point is that in refernce count GC I can be sure that fd is
deleted at the end of the block (yeah, I know that refcount is bad).



>So to answer your question, File.open works that way.  When you pass it a
>block, File.open closes the file descriptor after the block is finished. 
>The fd structure in memory still exists until the GC runs, but as far as
>the operating system is concerned, the file is closed.


sure, I know,  but someone on #ruby-lang pointed me to the idea that
ruby could understand when I'm using huge temp memory, and someway try
to chooce if it should free it (i.e. if it malloced lots of stuff in a
block it could choice to free 'em at the endo of the same block).
 So, is it true?