summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorJeremy Evans <[email protected]>2025-04-27 17:03:56 -0700
committerJean Boussier <[email protected]>2025-04-28 08:09:56 +0200
commit73f8d0a9c8ff4bc3d9380a09ec8de2c6f100320c (patch)
tree7a497ac0c9ba45541cd74ed0de0dd58b53139bf5 /test/ruby
parent3ec7bfff2e7ac4f6f69d26676edcfd2e73ea3b05 (diff)
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.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_gc.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index ccb46aeb9b..a1229fc87a 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -411,6 +411,8 @@ class TestGc < Test::Unit::TestCase
before_weak_references_count = GC.latest_gc_info(:weak_references_count)
before_retained_weak_references_count = GC.latest_gc_info(:retained_weak_references_count)
+ # Clear ary, so if ary itself is somewhere on the stack, it won't hold all references
+ ary.clear
ary = nil
# Free ary, which should empty out the wmap