From: Joel VanderWerf Date: 2006-10-27T05:31:25+09:00 Subject: Re: debugging memory use and GC ara.t.howard@noaa.gov wrote: > On Fri, 27 Oct 2006, Rick DeNatale wrote: > >> Not sure, what I was suggesting was that the real goal is to somehow root >> out the reference path or path which is keeping an object from being >> reclaimed without making additional references. > > > right. i was thinking of something like this: > > harp:~ > cat a.rb > def really_stupid_reference_finder obj That's a nice idea! One problem is that a referrer can be something other than an object: a ruby global var, a C global var, a local var. Or it can be an object that is not dumpable, such as a proc binding. But the throw/dump combo is a great trick to remember... What I'd really like to see is a general object graph traversal mechanism that can be used to help implement marshal and other dumpers, gc tools, etc. Several (3 or 4) years ago, matz said he was moving in this direction...[1] ---- [1] See: http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/marshal.c?cvsroot=src and grep for vjoel: * marshal.c (w_object): T_DATA process patch from Joel VanderWerf . This is temporary hack; it remains undocumented, and it will be removed when marshaling is re-designed. The hack is still there (as of 1.8.5, anyway), still undocumented, and still useful. The original discussion about why it is useful starts at: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/34037 -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407