From: Steve Mynott Date: 2001-09-04T00:55:53+09:00 Subject: [ruby-talk:20787] memory leak in simple tk script with ruby snapshot? Using ruby 1.7.1 (2001-09-01) [i686-linux] with tk and the following (trival) script I see an apparent memory leak. (Apologies if this is something wrong with my code not freeing memory since I am new to ruby) #################################################################### #!/usr/local/bin/ruby # $Id$ # require 'tk' $epoch = Time.at(1000000000) root = TkRoot.new { title "U1E9 countdown" } $label = TkLabel.new(root) { pack { padx 15 ; pady 15; side 'left' } proc{tick} } TkButton.new { text 'quit' command proc { root.destroy } pack('side'=>'left','fill'=>'both','expand'=>'yes') } Tk.after 50, proc {tick} def tick Tk.after 50, proc{tick} timediff = $epoch - Time.now days = (timediff/86400).to_i; timediff%=86400 hours = (timediff/3600).to_i; timediff%=3600 mins = (timediff/60).to_i; timediff%=60 secs = timediff.to_i $label.configure('text'=>"#{days} day(s), #{hours} hour(s), #{mins} min(s) and #{secs} sec(s) left") end root.bind "Control-c", proc{root.destroy} Tk.mainloop ########################################################## -- 1024/D9C69DF9 steve mynott steve@tightrope.demon.co.uk whenever people agree with me i always feel i must be wrong. -- oscar wilde