summaryrefslogtreecommitdiffhomepage
path: root/test/t/objectspace.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/t/objectspace.rb')
-rw-r--r--test/t/objectspace.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/t/objectspace.rb b/test/t/objectspace.rb
index bf79da902..06319dcbb 100644
--- a/test/t/objectspace.rb
+++ b/test/t/objectspace.rb
@@ -16,4 +16,20 @@ assert('ObjectSpace.count_objects') do
h0 = {:MRB_TT_FOO=>1000}
h = ObjectSpace.count_objects(h0)
assert_false(h0.has_key?(:MRB_TT_FOO))
+
+ GC.start
+ h_after = {}
+ h_before = ObjectSpace.count_objects
+
+ objs = []
+ 1000.times do
+ objs << {}
+ end
+ objs = nil
+ ObjectSpace.count_objects(h)
+ GC.start
+ ObjectSpace.count_objects(h_after)
+
+ assert_equal(h_before[:MRB_TT_HASH] + 1000, h[:MRB_TT_HASH])
+ assert_equal(h_before[:MRB_TT_HASH], h_after[:MRB_TT_HASH])
end \ No newline at end of file