From: Robert Klemme Date: 2003-11-18T02:12:18+09:00 Subject: Re: Long-running daemon acquiring giant memory footprint "Luke A. Kanies" schrieb im Newsbeitrag news:Pine.GSO.4.51.0311171048090.2656@pixie... > On Mon, 17 Nov 2003, Jason DiCioccio wrote: > > > Luke, > > After a while of debugging I found a bunch of objects that were being > > created that apparently contain one of the primary keys in one of my > > database tables. The thing is is the query should only return one result. > > This particular row is hardly ever referenced either. So now I have found > > a line in my code that is something like you might have been referring to: > > > > nsEntryId = nsEntryId[0][0] > > > > That is called quite often, would that cause the object to stay around? Not the old nsEntryId unless nsEntryId[0][0] has a reference to it. > > Is this what you were referring to? > > Yep, that's exactly what I'm referring to. If you undef your local copy > of nsEntryId, it still maintains a pointer to itself, so it becomes a > closed off lump of storage. I don't know much about ruby's memory > management, but it apparently can't catch these problems (I know perl > can't). Hmmm, since Ruby used mark and sweep GC it should be able to catch loops - self references as well as loops made of several instances. It seems to me that this is unlikely to be the reason for the memory growth. I'd rather assume some references as indicated above. Kind regards robert