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 (ObjectSpace.memsize_of_all): rename

ObjectSpace.total_memsize_of_all_objects() to
  ObjectSpace.memsize_of_all([klass]).
  Accept Class object to filter the objects.
* test/objspace/test_objspace.rb: fix test for above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2010-10-28 20:23:21 +00:00
parent 8bf968ff05
commit 8121a4f5a8
3 changed files with 44 additions and 15 deletions

View file

@ -19,8 +19,13 @@ class TestObjSpace < Test::Unit::TestCase
assert_kind_of(Integer, ObjectSpace.memsize_of(Struct.new(:a)))
end
def test_total_memsize_of_all_objects
assert_kind_of(Integer, ObjectSpace.total_memsize_of_all_objects)
def test_memsize_of_all
assert_kind_of(Integer, a = ObjectSpace.memsize_of_all)
assert_kind_of(Integer, b = ObjectSpace.memsize_of_all(String))
assert(a > b)
assert(a > 0)
assert(b > 0)
assert_raise(TypeError) {ObjectSpace.memsize_of_all('error')}
end
def test_count_objects_size