Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Free environ when RUBY_FREE_AT_EXIT #9463

Merged
merged 1 commit into from Jan 11, 2024

Conversation

peterzhu2118
Copy link
Member

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

cc. @HParker

missing/setproctitle.c Outdated Show resolved Hide resolved
missing/setproctitle.c Show resolved Hide resolved
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
@peterzhu2118 peterzhu2118 merged commit 057df43 into ruby:master Jan 11, 2024
96 checks passed
@peterzhu2118 peterzhu2118 deleted the free-proctitle branch January 11, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants