From 670b7be6c5fb9c3438fb6e36070401f25806f725 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Tue, 25 Feb 2020 13:12:53 +0900 Subject: should count only string. This code can generate CC objects so we only need to count existing String objects. --- test/ruby/test_hash.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 98ddbef1eb..3c799b7a04 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -266,10 +266,13 @@ class TestHash < Test::Unit::TestCase end def test_AREF_fstring_key + # warmup ObjectSpace.count_objects + ObjectSpace.count_objects + h = {"abc" => 1} - before = GC.stat(:total_allocated_objects) + before = ObjectSpace.count_objects[:T_STRING] 5.times{ h["abc"] } - assert_equal before, GC.stat(:total_allocated_objects) + assert_equal before, ObjectSpace.count_objects[:T_STRING] end def test_ASET_fstring_key -- cgit v1.2.3