From 28221e3584c62482359aa9294d4b690d26cfb852 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sun, 7 Apr 2013 13:34:53 +0000 Subject: merge revision(s) 39811: [Backport #8146] * 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/branches/ruby_2_0_0@40176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_gc.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 62ae7ae5be..e3186c9a44 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