ObjectSpace::WeakMap: fix compaction support

[Bug #19529]

`rb_gc_update_tbl_refs` can't be used on `w->obj2wmap` because it's
not a `VALUE -> VALUE` table, but a `VALUE -> VALUE *` table, so
we need some dedicated iterator.
This commit is contained in:
Jean Boussier 2023-03-14 09:12:55 +01:00 committed by Jean Boussier
parent ac65ce16e9
commit 548086b34e
Notes: git 2025-06-06 00:31:58 +00:00
2 changed files with 44 additions and 1 deletions

View file

@ -176,4 +176,12 @@ class TestWeakMap < Test::Unit::TestCase
end
end;
end
def test_compaction_bug_19529
obj = Object.new
100.times do |i|
GC.compact
@wm[i] = obj
end
end
end