From: Roger Pack Date: 2012-06-15T05:05:25+09:00 Subject: Re: MRI GC never collects? > That code appears to just eat memory forever, and never run the > finalizers. > > Am I missing anything here? Is it reproducible for y'all? Looks like I fell victim to the "never use a proc or block for a finalizer" trick. http://www.mikeperham.com/2010/02/24/the-trouble-with-ruby-finalizers/ The working version would be as follows: def finalized_proc benign proc { puts benign.to_s } end n = 0 loop { a = [3] ObjectSpace.define_finalizer(a, finalized_proc(n)) n += 1 if n % 10000 == 0 print '.' end } Jruby must be pretty smart to be able to avoid this somehow. -roger- -- Posted via http://www.ruby-forum.com/.