From: "nobu (Nobuyoshi Nakada)" Date: 2012-06-21T10:03:27+09:00 Subject: [ruby-core:45737] [ruby-trunk - Bug #6614] GC doesn't collect objects bound to (collectable) proc Issue #6614 has been updated by nobu (Nobuyoshi Nakada). A correction. Your code uses `print' but not `printf', so the arguments cannot be optimized out, even if necessary assumptions are all met. A possibility would be JRuby calls finalizers *BEFORE* the destruction. What's printed in JRuby? ---------------------------------------- Bug #6614: GC doesn't collect objects bound to (collectable) proc https://bugs.ruby-lang.org/issues/6614#change-27320 Author: rogerdpack (Roger Pack) Status: Rejected Priority: Normal Assignee: Category: Target version: ruby -v: tcs-ruby 1.9.3p28 (2012-01-28, TCS patched 2012-01-30) [i386-mingw32] Hello all. Previously discussed here: http://www.ruby-forum.com/topic/4402823 I would expect the following code to eventually run the finalizers mentioned: def finalized_puts bad ObjectSpace.define_finalizer(bad) { print 'collector run', bad } end loop { finalized_puts [] } This works in jruby as expected, but not in MRI. This has the unfortunate side effect of making define_finalizer *very* difficult to actually use right http://www.mikeperham.com/2010/02/24/the-trouble-with-ruby-finalizers/ Cheers! -- http://bugs.ruby-lang.org/