summaryrefslogtreecommitdiff
path: root/tool/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tool/lib')
-rw-r--r--tool/lib/envutil.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/tool/lib/envutil.rb b/tool/lib/envutil.rb
index 9be0aac479..309a6af40f 100644
--- a/tool/lib/envutil.rb
+++ b/tool/lib/envutil.rb
@@ -254,6 +254,14 @@ module EnvUtil
end
module_function :under_gc_compact_stress
+ def without_gc
+ prev_disabled = GC.disable
+ yield
+ ensure
+ GC.enable unless prev_disabled
+ end
+ module_function :without_gc
+
def with_default_external(enc)
suppress_warning { Encoding.default_external = enc }
yield