From 057df4379f856a868f588cdc769f397f5739983d Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 9 Jan 2024 13:17:17 -0500 Subject: 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: ': 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 --- internal/missing.h | 1 + 1 file changed, 1 insertion(+) (limited to 'internal') diff --git a/internal/missing.h b/internal/missing.h index c0992a151a..6ca508c8f9 100644 --- a/internal/missing.h +++ b/internal/missing.h @@ -13,6 +13,7 @@ /* missing/setproctitle.c */ #ifndef HAVE_SETPROCTITLE extern void ruby_init_setproctitle(int argc, char *argv[]); +extern void ruby_free_proctitle(void); #endif #endif /* INTERNAL_MISSING_H */ -- cgit v1.2.3