summaryrefslogtreecommitdiff
path: root/test/ruby/test_weakmap.rb
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-12-08 15:17:51 -0500
committerPeter Zhu <peter@peterzhu.ca>2023-12-12 09:01:21 -0500
commit33cf8f640bab35c463186ef0856689c22559fbeb (patch)
tree0ce361ab7d02f27526b494f941b1759b3514e1b3 /test/ruby/test_weakmap.rb
parentd313c82f797852037012138284d4e49fdaf284c4 (diff)
Make WeakMap safe for compaction during allocation
During allocation, the table may not have been allocated yet which would crash in the st_foreach.
Diffstat (limited to 'test/ruby/test_weakmap.rb')
-rw-r--r--test/ruby/test_weakmap.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_weakmap.rb b/test/ruby/test_weakmap.rb
index a30004bce3..0371afa77a 100644
--- a/test/ruby/test_weakmap.rb
+++ b/test/ruby/test_weakmap.rb
@@ -237,6 +237,10 @@ class TestWeakMap < Test::Unit::TestCase
end;
end
+ def test_gc_compact_stress
+ EnvUtil.under_gc_compact_stress { ObjectSpace::WeakMap.new }
+ end
+
def test_replaced_values_bug_19531
a = "A".dup
b = "B".dup