Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f48d0ba

Browse files
committed
Fix flaky TestGc#test_heaps_grow_independently
The test sometimes fails with "Expected 2062788 to be < 2000000" because heap 0 has not been cleared yet by GC. This commit fixes it to run GC before the assertion to ensure that it does not flake.
1 parent a1996b3 commit f48d0ba

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
@@ -701,6 +701,8 @@ def allocate_large_object = Array.new(10)
701701
allocate_large_object
702702
end
703703
704+
GC.start
705+
704706
heap_available_slots = GC.stat(:heap_available_slots)
705707
706708
assert_operator(heap_available_slots, :<, COUNT * 2, "GC.stat: #{GC.stat}\nGC.stat_heap: #{GC.stat_heap}")

0 commit comments

Comments
 (0)