From: Joel VanderWerf Date: 2006-10-29T05:25:55+09:00 Subject: Re: How to understand why object is not collected? Victor "Zverok" Shepelev wrote: > From: Joel VanderWerf [mailto:vjoel@path.berkeley.edu] > Sent: Saturday, October 28, 2006 10:52 PM >> This is probably a situation where GC is being conservative. A simple >> example: >> >> class Foo; end >> >> foo = Foo.new >> foo = nil >> >> GC.start >> >> p ObjectSpace.each_object(Foo) {} # ==> 1 > > OK, I've got it. > >> In my experience, it's hard to write precise unit tests for GC behavior, >> and you end up with some fuzziness. The important property of GC is >> really the asymptotic behavior. > > Just for now, I need no precise unit test. I just want to know, would the > objects of MyClass collected in principle. Can I achieve the goal somehow? What about creating a lot of them in a loop, without keeping references? Then I would expect GC to leave at most one instance. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407