summaryrefslogtreecommitdiff
path: root/test/ruby/test_gc.rb
diff options
context:
space:
mode:
authornari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-18 12:44:55 +0000
committernari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-18 12:44:55 +0000
commit1bc93a15912ab418bd54c0c064a47c557798eae9 (patch)
tree7dbe4ca58ec54f333bddc3178ad6715ba226c5ff /test/ruby/test_gc.rb
parent03c7f0ca43a65b18d81387f82bf91e5d5bc14bee (diff)
* 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
Diffstat (limited to 'test/ruby/test_gc.rb')
-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 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