This, and similar problems, are fixed by the MBARI patches available at:

http://sites.google.com/site/brentsrubypatches/

Here's the corrected output of your previously failing test case:

$ ruby18-mbari -v -e "a = Array.new(1000000){'a'};
         puts 'array nilled';
         a = nil;
         GC.start;
         count = 0;
         ObjectSpace.each_object{count += 1};
         IO.popen('free'){|p| puts count, p.read}"


ruby 1.8.7 (2009-1-23 MBARI 7/0x9770 on patchlevel 72) [i686-linux]
array nilled
391
             total       used       free     shared    buffers     cached
Mem:       2592504    2151832     440672          0     542352     726628
-/+ buffers/cache:     882852    1709652
Swap:      2931852          0    2931852

If you are building a 64-bit ruby binary, you should also apply the PPC
patch manually after to the rest of the MBARI patches.
I'll be integrating 64-bit support into the MBARI7 patch in the coming
weeks.

- brent


Jeremy Kemper-3 wrote:
> 
> Bug #649: Memory leak in a array assignment?
> http://redmine.ruby-lang.org/issues/show/649
> 
> Author: Henri Suur-Inkeroinen
> Status: Open, Priority: Normal
> 
> Hello,
> 
> I´m using "ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux]".
> 
> Problem:
> --------------------------------
> a = Array.new(1000000){'a'}
> a = nil
> GC.start
> The elements of array are not freed from the object space and the memory.
> ...
> 
> 

-- 
View this message in context: http://www.nabble.com/-ruby-core%3A19342---Bug--649--Memory-leak-in-a-array-assignment--tp19992083p21817340.html
Sent from the ruby-core mailing list archive at Nabble.com.