From: Roger Pack Date: 2008-08-03T00:48:19+09:00 Subject: Re: gc doesn't collect? John Winters wrote: > For the record, I've just tested this with Ruby 1.8.7 running on Debian > Lenny (x86-64) and it does not print 'aaaaaaa...' Interesting. Maybe there's a difference among versions. For me it has the resultant 'odd' behavior in Ubuntu with Ruby 1.8.6 patchlevel 111, os x, and windows mingw (all 32-bit) and ruby 1.8.5 [x86_64-linux]. Perhaps the 64-bit aspect is clearing the false positives. I also tested the following code on those same platforms, all running 1.8.6: def go 1.times { a = 'a'*1000}; end go def recurse b recurse b end begin recurse 33 # an attempt to "clear the stack" rescue => e print "rescued #{e}" end 30.times { GC.start }; ObjectSpace.each_object{|o| print o} This still showed the miscreant a's in ubuntu 32-bit, x86_64 Linux, and windows but not in OS X [it actually worked there]. FWIW. I guess this corroborates the theory that it's a false positive but I'm still uneasy about it. I guess it's not a huge problem, but still somewhat disconcerting. Some questions: Currently it appears that if there is a freeable objects that wants finalization within a page that can be freed, it doesn't add that that page to the freelist...I can't tell from the code, however, whether that page is basically 'pinned' "forever" or not, when that happens. And with ruby's current GC, it seems almost impossible to reclaim memory, so I don't even know how to test this [the test case being that there are finalizable objects within a page that wants to be freed--does that page ever get freed eventually?]. FL_SINGLETON seems to play some role I'm not sure what. In other news, please accept my apologies--it appears that rb_gc_finalize_deferred IS called by eval0 "every 256 eval0's" I'm not sure if that is optimal or not, or even a good idea, but at least it gets called. -R -- Posted via http://www.ruby-forum.com/.