From: Xeno Campanoli Date: 2009-05-08T08:11:40+09:00 Subject: Re: Ruby memory usage Pete Hodgson wrote: > Christopher Dicely wrote: >> On Thu, May 7, 2009 at 11:01 AM, Pete Hodgson >> wrote: >>> My team has noticed that these processes memory usage gradually grows For what it's worth, I have a pretty complex web app with multiple dimensional arrays referencing nested classes and it runs really slow when we have less than a gig of memory, which never really made sense to us for the level of stuff it was doing. I may just need to spend a lot more time cleaning up my code, but seems to me Ruby can eat a bit more memory than one might expect it should. xc >>> and one ~20 hours later: >>> 474: TZInfo::TimezoneTransitionInfo >>> 22: Gem::Version::Requirement >>> 738: Regexp >>> 104: MatchData >>> 300MB of virtual memory. >>> >>> Can anyone give me any clues on what's going on here? Or any pointers as >>> to what else I can in terms of measurements and instrumentation to get a >>> better insight as to what's going here? >> The first thing that jumps to mind is that the 54 instance of Thread >> in the later listing may be a sign of the problem; unless you really >> should have that many Threads hanging around, you may be doing >> something that is preventing used Thread objects from being garbage >> collected. If you are, for instance, launching a new thread when you >> get a message and they are hanging around after they aren't needed, >> that could explain the expanding memory usage. > > Hmm, you're right that is strange. I can't think of anywhere where I am > spawning threads after initial start up, so I'll look into that more and > see where that leads. Thanks Christopher! -- "I told the Republicans that when they stopped lying about me I'd stop telling the truth about them" -- Harry Truman.