Skip to content

Commit 73f8d0a

Browse files
jeremyevansbyroot
authored andcommitted
Fix nondeterministic failure in test_latest_gc_info_weak_references_count
Clear the ary variable before setting it to nil. Otherwise, if the previous ary value was somewhere on the stack, all references in it would be considered live, and the wmap size would be 10000.
1 parent 3ec7bff commit 73f8d0a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

test/ruby/test_gc.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ def test_latest_gc_info_weak_references_count
411411
before_weak_references_count = GC.latest_gc_info(:weak_references_count)
412412
before_retained_weak_references_count = GC.latest_gc_info(:retained_weak_references_count)
413413
414+
# Clear ary, so if ary itself is somewhere on the stack, it won't hold all references
415+
ary.clear
414416
ary = nil
415417
416418
# Free ary, which should empty out the wmap

0 commit comments

Comments
 (0)