evanwebb / gmail.com wrote:
> There is actually a simple reason. Remember that you're passing a
> block, ie. a closure, to define_finalizer. That closure holds on to
> the stuff like self, which in this case is the object to be finalized.
> Thus the finalizer code is actually keeping the object alive.

Oh yes, this has to be overlook easily. Usually I don't care about the 
time objects will be destroyed.

evanwebb / gmail.com wrote:
> ...there is no guarantee ... if it will even run at all.

I understand from the description, that a finalizer will run for an 
object directly after GC destroyes it. It will not be called if the 
program ends without calling GC ever, but if GC destroyes it, the call 
will be guaranteed. Is this correct?

Wolfgang NĂ¡dasi-Donner
-- 
Posted via http://www.ruby-forum.com/.