From: Tim Hunter Date: 2008-03-31T10:45:00+09:00 Subject: Re: GC help Joey Marino wrote: > I found out it is not the 3rd party code. I am downloading images (~320,000 > ct.) as strings, and saving each to a file. The file handlers are getting > closed. Using the Dike gem, I think I determined the bulk of the leaked > memory is in these string variables. But what I don't understand is that the > variables containing the strings are local to a method of an object and > should be unreferenced when that method is done, right? I've invoked GC at > the end of the method and after each iteration that the method gets called. > I've even set the strings to nil after they've been saved to a file and > before gc is called. The app is using 2G of ram and 4G of swap before it > runs of out memory and crashes about 1/3rd of the way through. I'm really > starting to doubt Ruby's ability to do memory intensive work. Any ideas? Many people have used Ruby for long-running tasks that use a lot of memory. If Ruby was not collecting unused strings, don't you think somebody would have noticed it by now? Actually, I think you've ruled out Ruby being the problem. What else is running? Could it be using up the memory? -- RMagick: http://rmagick.rubyforge.org/ RMagick 2: http://rmagick.rubyforge.org/rmagick2.html