Hi,
In message "[ruby-talk:04286] ObjectSpace.add_finalizer?"
on 00/08/01, Robert Feldt <feldt / ce.chalmers.se> writes:
|I figured I might track the problem down by printing out all objects
|before they are GC'ed with something like:
|
|# Add a finalizer that will print all objects to be finalized
|print_object = proc{ |id|
| print "GC finalizing #{id} (%s)\n" % ObjectSpace._id2ref(id).inspect
|}
|ObjectSpace.add_finalizer(print_object)
|
|but nothing is ever printed on stdout.
You have to invoke call_finalizer(obj) to arrange finalizer to be
called upon which object (I know it's a bad name). In addition,
_id2ref(id) may not work, since finalizers are executed AFTER object
destruction.
matz.