summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authorAdam Hess <[email protected]>2023-10-12 11:15:53 -0700
committerPeter Zhu <[email protected]>2023-12-07 15:52:35 -0500
commit6816e8efcff3be75f8020cd1b0ea57d3cd664bbc (patch)
tree8f8484b955ba25e9df6a2038db0f156e7cbf71e4 /ruby.c
parentb361a800c22e0248bf126d77e96a7bd4f9c34d1b (diff)
Free everything at shutdown
when the RUBY_FREE_ON_SHUTDOWN environment variable is set, manually free memory at shutdown. Co-authored-by: Nobuyoshi Nakada <[email protected]> Co-authored-by: Peter Zhu <[email protected]>
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ruby.c b/ruby.c
index a161bcb3d6..db25e1bc33 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1754,6 +1754,11 @@ ruby_opt_init(ruby_cmdline_options_t *opt)
"environment variables RUBY_GC_HEAP_%d_INIT_SLOTS");
}
+ if (getenv("RUBY_FREE_ON_EXIT")) {
+ rb_warn("Free on exit is experimental and may be unstable");
+ rb_free_on_exit = true;
+ }
+
#if USE_RJIT
// rb_call_builtin_inits depends on RubyVM::RJIT.enabled?
if (opt->rjit.on)