From: ara.t.howard@... Date: 2006-10-27T00:53:52+09:00 Subject: Re: debugging memory use and GC On Fri, 27 Oct 2006, Rick DeNatale wrote: > On 10/25/06, snacktime wrote: >> What is a good way to find out what objects are not being GC'd ? I am >> seeing a strange pattern I can't figure out. The app is handling >> large files and will use up to 150mb or so of memory and then when I >> call GC.start it goes back down to around 8mb. But after a few cycles >> memory stops being reclaimed. > > Of course, what you really want to know is not just what's not getting > GCed but WHY. > > This can be a difficult problem. You really want to find the > reference paths from root objects. > > Some GC languages like Smalltalk have methods in object to get a list > of everything which references it. I haven't seen such a facility in > Ruby. Then the problem with this is that calling this method > generates additional references to the objects referencing the object > etc. This kind of heisenberg effect makes building a tool to find > reference paths difficult. it would be expensive, but i wonder of dumping the objects in objectspace might be useful - since Marshal.dump already follows all references it seems like a custom _dump method on object which could all themselves to a tree might do the trick. in otherwords, if you dumped an object with a global tree in contect then all objects being dumped as a result would add themselves to this tree. after the dump, you simply keep a copy of the tree... just a thought... -a -- my religion is very simple. my religion is kindness. -- the dalai lama