ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: Muhammad Ali <redmine@ruby-lang.org>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:23252] [Bug #1392] Object#extend leaks memory on Ruby 1.9.1
Date: Sun, 19 Apr 2009 07:18:18 +0900	[thread overview]
Message-ID: <49ea51a1deec_323f5bb5b52104e@redmine.ruby-lang.org> (raw)

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

             reply	other threads:[~2009-04-18 22:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-18 22:18 Muhammad Ali [this message]
2009-04-20  3:43 ` [ruby-core:23258] Re: [Bug #1392] Object#extend leaks memory on Ruby 1.9.1 Yukihiro Matsumoto
2009-04-20 13:23   ` [ruby-core:23262] " Muhammad A. Ali
2009-04-20 14:22     ` [ruby-core:23263] " Muhammad A. Ali

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49ea51a1deec_323f5bb5b52104e@redmine.ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).