From: Michael Davis Date: 2001-06-09T23:55:09+09:00 Subject: [ruby-talk:16357] Re: Garbage Collection? The method eats memory for as long as it runs. When it completes all memory is returned. My intent is to keep a process running that does something similar for a very long time. Eating memory like it does means that the process will have a very limited time span. -----Original Message----- From: ts [SMTP:decoux@moulon.inra.fr] Sent: Saturday, June 09, 2001 8:32 AM To: ruby-talk ML Cc: ruby-talk@ruby-lang.org Subject: [ruby-talk:16355] Re: Garbage Collection? >>>>> "M" == Michael Davis 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