Skip to content

Commit a259ce4

Browse files
committed
Simplify weak_references count test initialization
Using an enumerator does not resolve the intermittent failures: 100+ failures in 10,000 iterations.
1 parent 04925c6 commit a259ce4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

test/ruby/test_gc.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,10 @@ def test_latest_gc_info_weak_references_count
393393
394394
# Create some objects and place it in a WeakMap
395395
wmap = ObjectSpace::WeakMap.new
396-
ary = Array.new(count)
397-
enum = count.times
398-
enum.each.with_index do |i|
396+
ary = Array.new(count) do |i|
399397
obj = Object.new
400-
ary[i] = obj
401398
wmap[obj] = nil
399+
obj
402400
end
403401
404402
# Run full GC to collect stats about weak references

0 commit comments

Comments
 (0)