diff options
author | Peter Zhu <[email protected]> | 2023-11-27 11:30:47 -0500 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2023-11-27 12:40:26 -0500 |
commit | 150ed44d87e2d5b00f38019a487e05a67a303482 (patch) | |
tree | 4529f79d8f9de20071717bc9c189b43e557ee346 /tool/lib | |
parent | 3af56e87ca79740521c81e1336cfb5523f55ee29 (diff) |
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.
Diffstat (limited to 'tool/lib')
-rw-r--r-- | tool/lib/envutil.rb | 9 |
1 files changed, 9 insertions, 0 deletions
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 |