Bug #1392: Object#extend leaks memory on Ruby 1.9.1
http://redmine.ruby-lang.org/issues/show/1392

Author: Muhammad Ali
Status: Open, Priority: Normal
Category: core, Target version: 1.9.1
ruby -v: ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux]

A few bytes are leaked every time Object#extend is called, here is a sample 1.9.1 script

# This code is Ruby 1.9.x and above only

@extend = ARGV[0]

module BetterHash
  def blabla
  end
end

unless @extend
  class Hash
    include BetterHash
  end
end

t = Time.now
1_000_000.times do
   s = {}
   s.extend BetterHash if @extend 
end
after = Time.now - t
puts "done with #{GC.count} gc runs after #{after} seconds"
sleep # so that it doesn't exit before we check the memory

more details here : 

http://oldmoe.blogspot.com/2009/04/objectextend-leaks-memory-on-ruby-191.html

oldmoe


----------------------------------------
http://redmine.ruby-lang.org