summaryrefslogtreecommitdiff
path: root/test/objspace
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-08 00:18:42 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-08 00:18:42 +0000
commit1c5b309211c8d41b2624766fdeb60cc5fa3faf94 (patch)
tree40e8d070a7035985a6e5642ff2fd3d3df5ae4eea /test/objspace
parent5b1065f3fee2a3cb0095a28a5bedaa3f74f09a5b (diff)
* 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
Diffstat (limited to 'test/objspace')
-rw-r--r--test/objspace/test_objspace.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb
index 723e6e431e..eeb8ffa664 100644
--- a/test/objspace/test_objspace.rb
+++ b/test/objspace/test_objspace.rb
@@ -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