Change heap walking to be safe for object allocation

This commit is contained in:
Peter Zhu 2021-03-12 19:36:58 +00:00
parent f9f13a4f6d
commit b25361f731
Notes: git 2021-03-25 03:31:33 +09:00
2 changed files with 95 additions and 46 deletions

View file

@ -233,4 +233,11 @@ End
assert_kind_of(meta, sclass)
assert_include(ObjectSpace.each_object(meta).to_a, sclass)
end
def test_each_object_with_allocation
assert_normal_exit(<<-End)
list = []
ObjectSpace.each_object { |o| list << Object.new }
End
end
end