From: "Sandor Szücs" Date: 2008-07-31T19:05:22+09:00 Subject: Re: gc doesn't collect? On 31.07.2008, at 02:13, 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? In my opinion GC has not collected 'a' at the time you run through your ObjectSpace. If you wait longer then 'a' will be collected. # this one collects 'a' on my machine: $ ruby -e "1.times { a = 'a'*1000}; 32.times { GC.start; sleep(1) }; print ObjectSpace.each_object{|o| print o} " regards, Sandor Szücs --