1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
Peter Zhu 2022-10-08 15:04:18 -04:00
parent 8483737bbf
commit b22a2803a8

View file

@ -406,6 +406,9 @@ class TestGc < Test::Unit::TestCase
# This test prevents bugs like [Bug #18929] # This test prevents bugs like [Bug #18929]
assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'RUBY' assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'RUBY'
# Grow the heap
@ary = 100_000.times.map { Object.new }
# Warmup to make sure heap stabilizes # Warmup to make sure heap stabilizes
1_000_000.times { Object.new } 1_000_000.times { Object.new }