1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/objspace/objspace.c (iow_size): return size of internal object

for ObjectSpace.memsize_of().
* test/objspace/test_objspace.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2012-12-08 00:18:42 +00:00
parent 5b1065f3fe
commit 1c5b309211
3 changed files with 25 additions and 1 deletions

View file

@ -92,4 +92,14 @@ class TestObjSpace < Test::Unit::TestCase
}
assert_operator(max, :>=, 1_001, "1000 elems + Array class")
end
def test_reachable_objects_size
ObjectSpace.each_object{|o|
ObjectSpace.reachable_objects_from(o).each{|reached_obj|
size = ObjectSpace.memsize_of(reached_obj)
assert_kind_of(Integer, size)
assert_operator(size, :>=, 0)
}
}
end
end