From 32ecda354f1556edbfdba4723716fa523acbc94d Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Mon, 18 Dec 2023 16:55:19 -0500 Subject: Support `GC.auto_compact = :empty` on debug builds This commit adds `GC.auto_compact = :empty` which will run auto-compaction sorting pages by empty slots so the most amount of objects will be moved. This will make it easier to write tests for auto-compaction. --- tool/lib/envutil.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tool') diff --git a/tool/lib/envutil.rb b/tool/lib/envutil.rb index e47523a24b..9be0aac479 100644 --- a/tool/lib/envutil.rb +++ b/tool/lib/envutil.rb @@ -245,9 +245,9 @@ module EnvUtil end module_function :under_gc_stress - def under_gc_compact_stress(&block) + def under_gc_compact_stress(val = :empty, &block) auto_compact = GC.auto_compact - GC.auto_compact = true + GC.auto_compact = val under_gc_stress(&block) ensure GC.auto_compact = auto_compact -- cgit v1.2.3