aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2022-08-17 09:38:11 -0400
committerPeter Zhu <peter@peterzhu.ca>2022-08-17 10:54:28 -0400
commitb4daf6e28e4e0291e8c4c90d4ec7c0a00f715965 (patch)
tree19223c5eebfc474cdd383fc6b52ce40464f12f6d /test
parentddb81b9307f7114fcb37f6fcc37b7692b1a40cb4 (diff)
downloadruby-b4daf6e28e4e0291e8c4c90d4ec7c0a00f715965.tar.gz
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.
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_gc.rb4
1 files changed, 4 insertions, 0 deletions
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