From: Robert Klemme Date: 2009-05-08T18:11:38+09:00 Subject: Re: Ruby memory usage 2009/5/8 Tony Arcieri : > On Thu, May 7, 2009 at 12:01 PM, Pete Hodgson wrote: > >> My team has noticed that these processes memory usage gradually grows >> over time. As a concrete example one of my processes starts life using >> around ~20MB of virtual memory, and 20 hours later is sitting at 382MB >> of virtual memory, 115MB resident. >> > > One thing to keep in mind is that MRI's garbage collector never returns > memory to the system, and doesn't do a very good job in general.  MRI has a > tendency towards unbounded heap growth over time, especially in long-running > processes. I believe this has changed with 1.9.1 - at least memory usage seems to not grow as much as with 1.8.*. Btw, you can easily construct a memory leak, which cannot necessarily be detected by counting objects: ruby19 -e 's="."*1024;t="";loop do t << s end' I.e., you can grow any String which is not frozen to arbitrary lengths. Btw, Pete, you might get more insight into your application if you dump deltas of object counts. IIRC we had a sample here in the group but I cannot find it at the moment. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/