diff options
author | Peter Zhu <peter@peterzhu.ca> | 2021-08-26 10:06:32 -0400 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2021-10-25 13:26:23 -0400 |
commit | a5b6598192c30187b19b892af3110a46f6a70d76 (patch) | |
tree | 4620f69a10659deb6f278b36c10ec7915194573e /test/objspace | |
parent | 6374be5a8188ff5ed2c70b9f1d76672c87a0eda7 (diff) | |
download | ruby-a5b6598192c30187b19b892af3110a46f6a70d76.tar.gz |
[Feature #18239] Implement VWA for strings
This commit adds support for embedded strings with variable capacity and
uses Variable Width Allocation to allocate strings.
Diffstat (limited to 'test/objspace')
-rw-r--r-- | test/objspace/test_objspace.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb index 8ed04f59c9..a1954d56a9 100644 --- a/test/objspace/test_objspace.rb +++ b/test/objspace/test_objspace.rb @@ -29,12 +29,12 @@ class TestObjSpace < Test::Unit::TestCase end def test_memsize_of_root_shared_string - a = "hello" * 5 + a = "a" * GC::INTERNAL_CONSTANTS[:RVARGC_MAX_ALLOCATE_SIZE] b = a.dup c = nil ObjectSpace.each_object(String) {|x| break c = x if x == a and x.frozen?} rv_size = GC::INTERNAL_CONSTANTS[:RVALUE_SIZE] - assert_equal([rv_size, rv_size, 26 + rv_size], [a, b, c].map {|x| ObjectSpace.memsize_of(x)}) + assert_equal([rv_size, rv_size, a.length + 1 + rv_size], [a, b, c].map {|x| ObjectSpace.memsize_of(x)}) end def test_argf_memsize |