>>>>> "M" == Michael Davis <mdavis / sevainc.com> writes:

M> Here is a test script that is similar to what my btree is doing.  The 
M> method test() eats memory like crazy.

 Well, this script 

pigeon% cat b.rb
#!/usr/bin/ruby
def test()
   a = []
   0.upto(99999) {|i| a[i] = rand(999999)}
   b = Marshal.dump(a)
   GC.start
end
 
def testing(count)
   0.upto(count) {|i| 
      system("ps aux | grep b.rb | grep -v grep") if i == 1
      test  
   }
end
 
system("ps aux | head -1")
testing(100)
system("ps aux | grep b.rb | grep -v grep")
 
pigeon% 

 has given

pigeon% b.rb
USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
ts       25158 99.9  0.8  3384 2208 pts/0    S    16:24   0:01 ruby ./b.rb
ts       25158 99.9  0.8  3384 2208 pts/0    S    16:24   2:03 ruby ./b.rb
pigeon% 



Guy Decoux