With the following code:
def finalized_puts bad, benign
ObjectSpace.define_finalizer(bad) { puts benign.to_s }
end
n = 0
loop {
a = [3]
finalized_puts a, n
GC.start
n += 1
if n % 10000 == 0
print ‘.’
end
}
I’d “expect” that every so often it spits out some numbers, as objects
are collected (jruby does do it this way).
However with both
ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
and
ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]
That code appears to just eat memory forever, and never run the
finalizers.
Am I missing anything here? Is it reproducible for y’all?
-roger-