From 150ed44d87e2d5b00f38019a487e05a67a303482 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Mon, 27 Nov 2023 11:30:47 -0500 Subject: Fix compaction during ary_make_partial The ary_make_shared call may allocate, which can trigger a GC compaction. This can cause the array to be embedded because it has a length of 0. --- tool/lib/envutil.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tool') diff --git a/tool/lib/envutil.rb b/tool/lib/envutil.rb index 1ca76d17a7..e47523a24b 100644 --- a/tool/lib/envutil.rb +++ b/tool/lib/envutil.rb @@ -245,6 +245,15 @@ module EnvUtil end module_function :under_gc_stress + def under_gc_compact_stress(&block) + auto_compact = GC.auto_compact + GC.auto_compact = true + under_gc_stress(&block) + ensure + GC.auto_compact = auto_compact + end + module_function :under_gc_compact_stress + def with_default_external(enc) suppress_warning { Encoding.default_external = enc } yield -- cgit v1.2.3