diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-10-24 18:33:14 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-11-11 18:49:19 +0900 |
| commit | 9eac9d71786a8dbec520d0541a91149f01adf8ea (patch) | |
| tree | 703d4e82d0e2d43c578cf497e6db53631756823c /test/ruby | |
| parent | 2a442121d1404f9519d83ac72ac24c58a8389b15 (diff) | |
[Bug #19969] Compact st_table after deleted if possible
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_hash.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index f95876d855..35d30095c2 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -1792,6 +1792,15 @@ class TestHash < Test::Unit::TestCase assert_no_memory_leak([], prepare, code, bug9187) end + def test_memory_size_after_delete + require 'objspace' + h = {} + 1000.times {|i| h[i] = true} + big = ObjectSpace.memsize_of(h) + 1000.times {|i| h.delete(i)} + assert_operator ObjectSpace.memsize_of(h), :<, big/10 + end + def test_wrapper bug9381 = '[ruby-core:59638] [Bug #9381]' |
