[#3419] Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...>

Hello list,

19 messages 2004/09/17
[#3422] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

[#3423] Re: Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...> 2004/09/17

On Friday 17 Sep 2004 12:01, ts wrote:

[#3424] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

[#3425] Re: Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...> 2004/09/17

On Friday 17 Sep 2004 12:37, ts wrote:

[#3426] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

[#3428] Re: Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...> 2004/09/17

On Friday 17 Sep 2004 13:05, ts wrote:

[#3429] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

Memory-leak --- block/exception related

From: Johan Holmberg <holmberg@...>
Date: 2004-09-19 12:17:29 UTC
List: ruby-core #3456
I think I've found a memory leak in recent versions of Ruby
(post 1.8.1 versions).

It occurs while running "test/unit", but I think it is a problem in
the core interpreter.

For details see the comments in the testcase file below.

/Johan Holmberg


############################################################
# Filename: TC_memory_leak.rb
#
# Demonstration of yield/block/exception(???) related memory leak.
# Run it in the two following ways:
#
#    $ ruby TC_memory_leak.rb --name=test_memory_leak
#    $ ruby TC_memory_leak.rb --name=test_no_memory_leak
#
# and note the difference by looking at the Ruby process
# with top(1) in another window. The first will "eat" memory.
#
# The only difference is that "assert_raises" is used in the first case
# and "assert_raise" (with no "s") in the second. "assert_raises" is
# defined like this:
#
#      def assert_raises(*args, &block)
#        assert_raise(*args, &block)
#      end
#
# For some reason this indirection causes a memory leak.
#
# Ruby 1.8.1 is not affected.
# But both the latest on the "CVS-mainline" and on the "ruby_1_8" branch
# seem to be affected by the leak.
#

require 'test/unit'

class TestMemoryLeak < Test::Unit::TestCase

  def test_memory_leak
    10_000_000.times {
      assert_raises(Errno::ENOENT) { raise Errno::ENOENT }
    }
  end

  def test_no_memory_leak
    10_000_000.times {
      assert_raise(Errno::ENOENT) { raise Errno::ENOENT }
    }
  end

end

############################################################
# End of TC_memory_leak.rb
############################################################

In This Thread

Prev Next