[Wtr-general] OT: odd memory behavior question

Bret Pettichord bret at pettichord.com
Thu Oct 5 03:11:10 EDT 2006


On 10/4/06, Chris McMahon <christopher.mcmahon at gmail.com> wrote:
>
> However, it seems that when I clear the array with "ginormous_array = []",
> Ruby doesn't give back the memory it took loading it up in the first place.
>
>
> 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.

Bret
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20061005/5ecec5a7/attachment.html 


More information about the Wtr-general mailing list