diff options
author | Peter Zhu <peter@peterzhu.ca> | 2024-01-09 13:17:17 -0500 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2024-01-11 10:09:53 -0500 |
commit | 057df4379f856a868f588cdc769f397f5739983d (patch) | |
tree | 2cc451d9af23b2c69a8804383ee754922ddff6c5 /vm.c | |
parent | 4e0c2f05efc9415b52b50ee65401c5b511d269e7 (diff) |
Free environ when RUBY_FREE_AT_EXIT
The environ is malloc'd, so it gets reported as a memory leak. This
commit adds ruby_free_proctitle which frees it during shutdown when
RUBY_FREE_AT_EXIT is set.
STACK OF 1 INSTANCE OF 'ROOT LEAK: <calloc in ruby_init_setproctitle>':
5 dyld 0x18b7090e0 start + 2360
4 ruby 0x10000e3a8 main + 100 main.c:58
3 ruby 0x1000b4dfc ruby_options + 180 eval.c:121
2 ruby 0x1001c5f70 ruby_process_options + 200 ruby.c:3014
1 ruby 0x10035c9fc ruby_init_setproctitle + 76 setproctitle.c:105
0 libsystem_malloc.dylib 0x18b8c7b78 _malloc_zone_calloc_instrumented_or_legacy + 100
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -20,6 +20,7 @@ #include "internal/eval.h" #include "internal/gc.h" #include "internal/inits.h" +#include "internal/missing.h" #include "internal/object.h" #include "internal/proc.h" #include "internal/re.h" @@ -3034,6 +3035,10 @@ ruby_vm_destruct(rb_vm_t *vm) xfree(th->nt); th->nt = NULL; } + +#ifndef HAVE_SETPROCTITLE + ruby_free_proctitle(); +#endif } else { if (th) { |