[Wtr-general] OT: odd memory behavior question
Chris McMahon
christopher.mcmahon at gmail.com
Thu Oct 5 11:08:56 EDT 2006
>
> > Anyone have a suggestion of how to force Ruby to give back the memory
> > for an array that no longer contains any data?
>
>
>
> You need to run the garbage collector. It is something like this:
>
> GC.start
>
> You also need to make sure that you don't retain any references to any
> bits of the array. Assign them to nil, or better, ensure they are out of
> scope.
>
This is good to know. However, I didn't have to resort to using it.
Running the process overnight, reloading ginormous_array 5 times, it seems
that Ruby is re-using a lot of this memory. My Ruby process is still
holding on to a lot of memory, but not nearly as much as loading the whole
set of data into a single array.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20061005/30956488/attachment.html
More information about the Wtr-general
mailing list