diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_objectspace.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_objectspace.rb b/test/ruby/test_objectspace.rb index c352b75b70..243e9f681c 100644 --- a/test/ruby/test_objectspace.rb +++ b/test/ruby/test_objectspace.rb @@ -35,6 +35,26 @@ End deftest_id2ref(false) deftest_id2ref(nil) + def test_id2ref_liveness + assert_normal_exit <<-EOS + ids = [] + 10.times{ + 1_000.times{ + ids << 'hello'.object_id + } + objs = ids.map{|id| + begin + ObjectSpace._id2ref(id) + rescue RangeError + nil + end + } + GC.start + objs.each{|e| e.inspect} + } + EOS + end + def test_count_objects h = {} ObjectSpace.count_objects(h) |