summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-07 13:34:53 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-07 13:34:53 +0000
commit28221e3584c62482359aa9294d4b690d26cfb852 (patch)
tree9d52ccaf1d79c495496e983044dd48714a4fc3ab /test/ruby
parent6c0822f0f5e934f6197f5a1be577764a74b30c7f (diff)
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
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_gc.rb14
1 files changed, 14 insertions, 0 deletions
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