Project

General

Profile

Backport #461

Updated by jeremyevans0 (Jeremy Evans) over 5 years ago

=begin 
  
  Hi, 
 
  At Wed, 20 Aug 2008 04:46:24 +0900, 
  Sven C. Koehler wrote in [ruby-talk:311847]: 
  > could someone help me understand why this code leaks memory? (I am using 
  > ruby 1.8.6 (2007-12-03 patchlevel 113) [x86_64-linux].) 
  >  
  > def rss_leaks 
  >     /^VmRSS:\s+(\d+)/m.match(File.open("/proc/#{$$}/status") {|f|  
  >         f.read })[1].to_i 
  > end 
 
  > Calling GC.start inbetween does not help, but when we rewrote rss_leaks 
  > this way the leaks disappeared: 
  >  
  > def rss_no_leaks() 
  >      d = File.open("/proc/#{$$}/status") {|f| f.read } 
  >      /^VmRSS:\s+(\d+)/m.match(d)[1].to_i 
  > end 
 
  Seems a bug. 
 
  --  
  Nobu Nakada 
 
 =end 
 

Back