summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2022-10-08 15:04:18 -0400
committerPeter Zhu <peter@peterzhu.ca>2022-10-08 15:06:30 -0400
commitb22a2803a86d6adabc24dd00ef5ae90762a2ae46 (patch)
treef4b0fc9535aa284ea6273b4cea26d5c1d3dcbd55
parent8483737bbfff506996777991f8dca7f45ce422d5 (diff)
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.
-rw-r--r--test/ruby/test_gc.rb3
1 files changed, 3 insertions, 0 deletions
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 }