[Wtr-general] OT: odd memory behavior question

Bret Pettichord bret at pettichord.com
Thu Oct 5 14:44:59 EDT 2006


    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. 


Ruby will run the garbage collector automatically when it runs out of 
memory. You probably want to learn more about how Ruby allocates memory.

For example

 string << "addendum"

modifies an existing string, whereas

  string += "addendum"

creates a new one, thus using memory.

Little things like this starting becoming really important when you have 
large data sets.

Bret



More information about the Wtr-general mailing list