diff options
author | Koichi Sasada <ko1@atdot.net> | 2021-05-12 17:35:57 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2021-05-12 17:40:31 +0900 |
commit | 523a6998dd45eb910ccd3fe6a8d9d008f7a12cf2 (patch) | |
tree | 721a2827b9d2155d9f35b09c5baa2ef5ad5c0708 | |
parent | 81720b947ac1ee8ed5dba551d38014810f9c129b (diff) |
Use another class for the comparison.
`memsize_of(Object.new)` can be changed with past ivar creation
history for Object instances (another Object instance has 4 or
more ivars, next created Object instance has the area for the
ivars). So use antoher class for the comparison.
-rw-r--r-- | test/objspace/test_objspace.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb index 812b0817a8..8a0b6fba20 100644 --- a/test/objspace/test_objspace.rb +++ b/test/objspace/test_objspace.rb @@ -106,10 +106,9 @@ class TestObjSpace < Test::Unit::TestCase end def test_memsize_of_iseq - skip # To debug - iseqw = RubyVM::InstructionSequence.compile('def a; a = :b; a; end') - base_obj_size = ObjectSpace.memsize_of(Object.new) + # Use anonymous class as a basic object size because size of Object.new can be increased + base_obj_size = ObjectSpace.memsize_of(Class.new.new) assert_operator(ObjectSpace.memsize_of(iseqw), :>, base_obj_size) end |