summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2025-06-15 22:22:30 +0900
committerNobuyoshi Nakada <[email protected]>2025-06-15 23:59:47 +0900
commita259ce406f14f3e044beaa35a16b650920e248d1 (patch)
tree6e95801a515a77daf9d7e62beccba249e604aa50
parent04925c6608f3e8f869ed9764b69d9273a1238fbe (diff)
Simplify weak_references count test initialization
Using an enumerator does not resolve the intermittent failures: 100+ failures in 10,000 iterations.
-rw-r--r--test/ruby/test_gc.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index daa645b349..953baf9928 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -393,12 +393,10 @@ class TestGc < Test::Unit::TestCase
# Create some objects and place it in a WeakMap
wmap = ObjectSpace::WeakMap.new
- ary = Array.new(count)
- enum = count.times
- enum.each.with_index do |i|
+ ary = Array.new(count) do |i|
obj = Object.new
- ary[i] = obj
wmap[obj] = nil
+ obj
end
# Run full GC to collect stats about weak references