From: Michal Babej Date: 2009-02-21T18:56:16+09:00 Subject: [ruby-core:22306] Re: [Bug #744] memory leak in callcc? --Boundary-00=_M/8nJ4UtInCn4V7 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 --Boundary-00=_M/8nJ4UtInCn4V7 Content-Type: application/x-ruby; name="array_test.rb" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="array_test.rb" #!/usr/bin/env ruby WRITE_BATCH_SIZE=ARGV[0].to_i unless WRITE_BATCH_SIZE>0 puts "Usage: #{$0} WRITE_BATCH_SIZE" exit 1 end #GC.disable puts "\n*** memory used before allocating array: ***" system('/bin/sh','-c',"cat /proc/#{Process.pid}/status | grep VmRSS") array = (1..1_000_000).map { rand } puts "\n*** memory used after allocation: ***" system('/bin/sh','-c',"cat /proc/#{Process.pid}/status | grep VmRSS") puts "\n\n\n" puts "\n*** free memory before fork: ***" system('/bin/sh','-c','free | grep buffers') #GC.disable pid = fork if pid Process.wait(pid) else puts "\n*** free memory after fork: ***" system('/bin/sh','-c','free | grep buffers') # just to show RSS doesn't change and does *not* reflect real memory usage in this case puts "\n*** child's VmRSS before any change: ***" system('/bin/sh','-c',"cat /proc/#{Process.pid}/status | grep VmRSS") puts "\n\n\n" write_start = 0 10.times do sleep 2 puts "writing.." WRITE_BATCH_SIZE.times { |i| array[write_start + i]=rand } write_start += WRITE_BATCH_SIZE puts 'done.' puts "*** memory state after rewriting #{WRITE_BATCH_SIZE} floats of array: ***" system('/bin/sh','-c',"cat /proc/#{Process.pid}/status | grep VmRSS") system('/bin/sh','-c','free | grep buffers') puts "\n" end end --Boundary-00=_M/8nJ4UtInCn4V7--