diff options
author | Peter Zhu <peter@peterzhu.ca> | 2023-03-14 23:18:11 -0400 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2023-03-14 23:18:11 -0400 |
commit | 3dc8cde70078ccb38f5f4b0818ad5eecded01bd5 (patch) | |
tree | c75cefa316ff3a2af04bea8f7a16fa0d1ee1bc53 /test/ruby/test_weakmap.rb | |
parent | 70ba3102129dbaf6c943d1ed042103e0238842f4 (diff) |
Fix crash during compaction
[Bug #19529]
The fix for [Bug #19529] in commit 548086b contained a bug that crashes
on the following script:
```
wm = ObjectSpace::WeakMap.new
obj = Object.new
100.times do
wm[Object.new] = obj
GC.start
end
GC.compact
```
Diffstat (limited to 'test/ruby/test_weakmap.rb')
-rw-r--r-- | test/ruby/test_weakmap.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_weakmap.rb b/test/ruby/test_weakmap.rb index d84eb8241e..9bbe2d6b81 100644 --- a/test/ruby/test_weakmap.rb +++ b/test/ruby/test_weakmap.rb @@ -183,5 +183,15 @@ class TestWeakMap < Test::Unit::TestCase GC.compact @wm[i] = obj end + + assert_separately(%w(--disable-gems), <<-'end;') + wm = ObjectSpace::WeakMap.new + obj = Object.new + 100.times do + wm[Object.new] = obj + GC.start + end + GC.compact + end; end end |