I'm debugging an application where the bug seems to be when objects are to
be garbage collected (might be some problem with the free func for one of
my extensions ie. I'm not claiming bug in Ruby GC).
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.
Have I used the ObjectSpace methods/funcs in the right way? Why doesn't it
print all objects to be GC'ed?
Any hints greatly appreciated!
Regards,
Robert