From: Joel VanderWerf Date: 2005-08-12T04:25:35+09:00 Subject: Re: force_recycle Kroeger Simon (ext) wrote: > Hi Nobu, > > i realy appreciate your input but that's not the kind of problem > I'm facing (and I probably should have elaborated the issue > further when asking such questions). > At one point in our project a large number of plain ruby objects > gets alocated (no relation to external resources) and stored in > an array (all of the same class). This happens from various Threads > but in a (hopefully) threadsafe manner. Later this array gets > #clear(ed). After GC there are still instances of the class in the > ObjectSpace even though this special class is only used for > elements of this array. This process repeats itself over and > over again and after some hours we have hundreds of MB memory > leak. > > So, what I'm realy looking for is a way to ask: 'hey almighty > shepherd of objects, why are you still clinging to xyz?' I patched the ruby interpreter to divulge this information, but that was back at 1.6 and 1.7, so it would probably need some work for 1.8. If you're interested, there's a mention of the patch at http://www.rubygarden.org/ruby?GCAndMemoryManagement and the patch itself is at http://www.google.com/url?sa=D&q=http%3A%2F%2Fredshift.sourceforge.net%2Fdebugging-GC%2F Briefly, the patch adds a method GC.reachability_paths obj which returns a list of all the ways you can reference that object, starting from the basic references such as C and ruby globals, stack variables, and others. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407