From: ara.t.howard@... Date: 2006-03-18T00:47:54+09:00 Subject: Re: Writing long-running daemons without memory leaks? On Sat, 18 Mar 2006, Toby DiPasquale wrote: > Hi all, > > I am in the middle of writing some code that will exist as a > long-running process on a number of machines. I am having trouble > keeping memory utilization down, which is important in this case, > because other processes on these machines will have priority to use the > majority of RAM on these boxes for other tasks. The daemon itself is > pretty simple, just reading and writing files and keeping some small > state, but it also needs to cache large writes from multiple clients. > When it does this, I find that this memory is not freed. > > My question is, I've heard from numerous accounts that WEBrick also > leaks memory, and I would suspect that Mongrel does, too (though I > haven't confirmed that) for the same reason. I understand that Ruby's GC > is conservative, but can anyone point me to documentation, reference, > source code, anything really that will help me better understand how to > write Ruby code that doesn't "leak" and can be sustained as a > long-running process without an ever-increasing memory footprint? > > Any help would be greatly appreciated. Thanks in advance. > > P.S. I've read the Pickaxe's lone page on the subject (in the Duck > Typing chapter) and I've seen Why's article about the same > (http://whytheluckystiff.net/articles/theFullyUpturnedBin.html). > > P.P.S. Has Minero Aoki's Ruby book been translated to English anywhere? > I hear that it has a whole chapter on GC... i'm running dozens of ruby daemons, some of which are extremely (months at a time) long lived and have not seen any gc issues. can you post a specific (minimal) example that you find leaks memory? regards. -a -- share your knowledge. it's a way to achieve immortality. - h.h. the 14th dali lama