From: Christopher Dicely Date: 2008-04-02T14:32:06+09:00 Subject: Re: GC help On Sun, Mar 30, 2008 at 5:07 PM, 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? Usually, yes. However, there are ways a reference could be kept live beyond the end of the method. Obviously, if you pass the string out of the method to something else that keeps a reference to it, that would do it, but also if you pass a closure (e.g., a proc object) that refers to the methods application's binding (I think that's the right terminology) that gets stored somewhere else, that would keep the method's local variables "live" even after the method exits. Its hard to say if something like that might be happening without the code.