On 3/27/07, Jason Roelofs <jameskilton / gmail.com> wrote: > So my first question is this: why are you doing this? Ruby's garbage > collector is perfectly capable of finding and preventing REAL memory leaks. > > What you have here is not a memory leak detector, but an "objects have been > created" detector. "hello" is then obviously caught as a new object created, > and as Ruby returns the result of the last statement of a method, it is not > yet out of scope until the program quits, in your case. There's also the problem that he's trying to detect surviving objects by comparing object_ids before and after GC, there's no guarantee that an object_id of a gc'd object won't be reused. Object_id's only need to be unique among LIVE objects. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/