From b4daf6e28e4e0291e8c4c90d4ec7c0a00f715965 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 17 Aug 2022 09:38:11 -0400 Subject: [PATCH] Fix flaky test for GC thrashing GC could be in an intermediate state after creating the objects, so we should finish GC by running a minor GC. --- test/ruby/test_gc.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index a1e782daa9..d2f1e21e33 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -413,6 +413,10 @@ class TestGc < Test::Unit::TestCase 1_000_000.times { Object.new } + # Previous loop may have caused GC to be in an intermediate state, + # running a minor GC here will guarantee that GC will be complete + GC.start(full_mark: false) + after_stats = GC.stat # Should not be thrashing in page creation