Michal,

What you are seeing in unpatched ruby is memory leaking between your
"passes" in array_test.rb.
This is just another manifestation of the same leak that occurs with
unpatched ruby and the script:

loop do
  @x=callcc{|c|c}
end

(see leakcheck.rb in the MBARIpatches tarball and the innocent redmine
 entry at the top of this endless thread)

The uninitialized stack for iteration n+1 contains old (dead) object
references from
iteration n.  The GC strings them all together into a linked list of object
references.
It therfore cannot collect any of them until the whole loop terminates.

The stack clearing patches break this bogus chain of stale object reference
links and
thus allow the GC to properly identify refs from previous iterations of the
loop as
being "dead".

I pushed an update to the patches onto github last night that seems to
improve
stability of the MBARI patches on the x86_64 platform.  Others platforms
seem to be working
great, but the x86_64 still has exhibits vexing, very occasional segfaults.

I'll be working on it through this rainy weekend.  If I can see it, I'm
confident I can (eventually)
fix it.

- brent


Bugzilla from calcifer / runbox.com wrote:
> 
> Hi,
> 
> On Friday 20 of February 2009 23:14:13 Roger Pack wrote:
>> The moon is in a good phase. LOL.
>> It does seem more stable using the latest version.  I will report back
>> if the errors occur more.
> Turns out, good moon phases end right after writing a positive feedback
> emails 
> :) Feb 15 ruby-mbari runs the full test suite with same errors as
> unpatched 
> ruby on my machine, but it still segfaults on some certain tests.  E.g. 
> running "test/runner.rb net" in row quickly results in segfault.
> 
> P.S. i wrote a small script to see how ruby works with fork's
> copy-on-write 
> mechanism. It allocates an array of 1 mil float, then forks, and in the
> child 
> starts rewriting the array in batches (batch size is ARGV[0]). It gives 
> completely different results for mbari ruby, and i'd be glad if someone
> could 
> explain why :)
> 
> -- Michal
> 
> 
>  
> 

-- 
View this message in context: http://www.nabble.com/-ruby-core%3A19846---Bug--744--memory-leak-in-callcc--tp20447794p22139637.html
Sent from the ruby-core mailing list archive at Nabble.com.