From b22a2803a86d6adabc24dd00ef5ae90762a2ae46 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Sat, 8 Oct 2022 15:04:18 -0400 Subject: Fix flaky test test_thrashing_for_young_objects The test could be flaky when a heap has below GC_HEAP_INIT_SLOTS number of free slots because it would trigger a major GC and allocate more pages. --- test/ruby/test_gc.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 7b0c0b85ab..06bf038cae 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -406,6 +406,9 @@ class TestGc < Test::Unit::TestCase # This test prevents bugs like [Bug #18929] assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'RUBY' + # Grow the heap + @ary = 100_000.times.map { Object.new } + # Warmup to make sure heap stabilizes 1_000_000.times { Object.new } -- cgit v1.2.3