summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-04 10:05:40 +0000
committertmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-04 10:05:40 +0000
commit907a03fee52b06760cec2d6fbd0dd2e693bef970 (patch)
treeb2c85e80be1bc9b481422d37ca69d351b73d3a43 /test
parenta24705cfa52d14470354600832d129c5b8af64a1 (diff)
gc.c: add objspace_free_num and make GC.stat[:heap_free_num] use it
* gc.c (objspace_free_num): new method for available/free slots on heap. [ruby-core:57633] [Bug #8983] * gc.c (gc_stat): change heap_free_num definition to use new method. * test/ruby/test_gc.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_gc.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index 53fd107747..30baebb67a 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -70,6 +70,13 @@ class TestGc < Test::Unit::TestCase
GC.stat(stat)
ObjectSpace.count_objects(count)
assert_equal(count[:TOTAL]-count[:FREE], stat[:heap_live_num])
+ assert_equal(count[:FREE], stat[:heap_free_num])
+
+ # measure again without GC.start
+ 1000.times{ "a" + "b" }
+ GC.stat(stat)
+ ObjectSpace.count_objects(count)
+ assert_equal(count[:FREE], stat[:heap_free_num])
end
def test_singleton_method