ruby-changes:72950
From: Peter <ko1@a...>
Date: Wed, 17 Aug 2022 23:54:45 +0900 (JST)
Subject: [ruby-changes:72950] b4daf6e28e (master): Fix flaky test for GC thrashing
https://git.ruby-lang.org/ruby.git/commit/?id=b4daf6e28e From b4daf6e28e4e0291e8c4c90d4ec7c0a00f715965 Mon Sep 17 00:00:00 2001 From: Peter Zhu <peter@p...> Date: Wed, 17 Aug 2022 09:38:11 -0400 Subject: 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_gc.rb#L413 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 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/