From 1bc93a15912ab418bd54c0c064a47c557798eae9 Mon Sep 17 00:00:00 2001 From: nari Date: Mon, 18 Mar 2013 12:44:55 +0000 Subject: * gc.c: Avoid unnecessary heap growth. patched by tmm1(Aman Gupta). [Bug #8093] [ruby-core:53393] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_gc.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/ruby/test_gc.rb') diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index bed58f3830..90c47875ee 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -146,4 +146,18 @@ class TestGc < Test::Unit::TestCase ObjectSpace.define_finalizer(Thread.main) { p 'finalize' } EOS end + + def test_expand_heap + assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'eom' + base_length = GC.stat[:heap_length] + (base_length * 500).times{ 'a' } + GC.start + assert_equal base_length, GC.stat[:heap_length], "invalid heap expanding" + + a = [] + (base_length * 500).times{ a << 'a' } + GC.start + assert base_length < GC.stat[:heap_length] + eom + end end -- cgit v1.2.3