Skip to content

Commit

Permalink
Change test_warmup_frees_pages to check each size pool
Browse files Browse the repository at this point in the history
This should help in debugging the intermittent test failures on CI:

    TestProcess#test_warmup_frees_pages [test/ruby/test_process.rb:2779]:
    <201> expected but was
    <202>.
  • Loading branch information
peterzhu2118 committed Dec 30, 2023
1 parent 606c017 commit 8e32c01
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/ruby/test_process.rb
Expand Up @@ -2771,12 +2771,14 @@ def test_warmup_frees_pages
# Disable GC so we can make sure GC only runs in Process.warmup
GC.disable
total_pages_before = GC.stat(:heap_eden_pages) + GC.stat(:heap_allocatable_pages)
total_pages_before = GC.stat_heap.map { |_, v| v[:heap_eden_pages] + v[:heap_allocatable_pages] }
Process.warmup
# Number of pages freed should cause equal increase in number of allocatable pages.
assert_equal(total_pages_before, GC.stat(:heap_eden_pages) + GC.stat(:heap_allocatable_pages))
total_pages_before.each_with_index do |val, i|
assert_equal(val, GC.stat_heap(i, :heap_eden_pages) + GC.stat_heap(i, :heap_allocatable_pages), "size pool: #{i}")
end
assert_equal(0, GC.stat(:heap_tomb_pages))
assert_operator(GC.stat(:total_freed_pages), :>, 0)
end;
Expand Down

0 comments on commit 8e32c01

Please sign in to comment.