"gabriele renzi" <surrender_it / remove.yahoo.it> schrieb im Newsbeitrag
news:7kp8ivg68h2ktu9gql7d5ofm9m6o7spt27 / 4ax.com...
> I just came across a diuscussion about C++ smart pointers and Python's
> refcount GC.
> So I fall in the doubt:
>
> If I call File.open 'my_huge_file' { |fd|
> ..
> }
>
> How should I feel? :)
> I mean: would fd be freed or have I to manually start the GC after the
> block?

I don't see the problem since fd is just the File instance, i.e. mainly
the file handle.  That doesn't consume much mem.  It especially consumes
the same amount of mem for every file (at least it's likely to be bounded
by a buffer size.)

Or am I wrong?

> actually the question could be: when GC gets called ?

Whenever ruby feels like it or you tell the interpreter. :-)

    robert