From 36d669b73db26368cb9492231be4b3d4ed97f111 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Mon, 31 Jul 2023 14:52:25 -0400 Subject: [PATCH] Fix test_gc_parameter_init_slots If the stack is not cleared (e.g. compiling with -O0), then `ary` could remain on the stack, which would be marked. Clear the array first to make sure all the objects can be GC'd. --- test/ruby/test_gc.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 811ab3edad..8d315fa925 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -438,6 +438,7 @@ class TestGc < Test::Unit::TestCase while GC.stat_heap(0, :heap_allocatable_pages) != 0 ary << Object.new end + ary.clear ary = nil # Clear all the objects that were allocated.