From: Eric Hodel Date: 2008-07-31T09:40:12+09:00 Subject: Re: gc doesn't collect? On Jul 30, 2008, at 17:13 PM, Roger Pack wrote: > Any ideas why: > > 1.times { a = 'a'*1000}; > 30.times { GC.start }; > print ObjectSpace.each_object{|o| print o} > > prints out 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...' despite the fact that > the a's should have been collected? Ruby's garbage collector walks the C stack looking for values that appear to point to the ruby heap. Ruby thinks you still have a reference to your string because of this.