From: "Luke A. Kanies" Date: 2003-11-08T06:44:00+09:00 Subject: Re: Long-running daemon acquiring giant memory footprint On Sat, 8 Nov 2003, Jason DiCioccio wrote: > I have written a long-running daemon in ruby to handle dynamic DNS updates. > I have just recently moved it from ruby 1.6 to ruby 1.8 and updated all of > its libraries to their latest versions (it uses dbi and dbd-postgres). The > problem i am having now is that it appears to start out using a sane amount > of memory (around 8mb) but then by the next day around the same time will > be using close to 200MB for the ruby interpreter alone. The daemon code > itself is 100% ruby so I don't understand how this leak is happening. Are > there any dangerous code segments I should look for that could make it do > this? The only thing I could think of is the fact that every returned > object from a sql query is .dup'd since ruby dbi passes a reference. > However, these should be getting swept up automatically by the garbage > collector. This is driving me nuts and I would love it if someone could > point me in the right direction.. The last time this happened to me it was because I had a member of a hash referring to the parent. I would assume that that would reliably cause memory holes in just about any language. I would double check your code, see if you can find anything. I resolved the problem by chopping the code up until I found the growing part. Good luck! Luke -- "Greenspun's Tenth Rule of Programming: any sufficiently complicated C or Fortran program contains an ad hoc informally-specified bug-ridden slow implementation of half of Common Lisp." - Phil Greenspun