Closed jpcrs closed 1 year ago
Noticed some small memory increase on the helper process. Analyzing with leaks it's pointing some memory leaks:
helper
leaks
Process: helper [37285] Path: /Users/USER/*/helper Load Address: 0x10014c000 Identifier: helper Version: 0 Code Type: ARM64 Platform: macOS Parent Process: ??? [1] Date/Time: 2023-01-04 14:32:04.429 +0000 Launch Time: 2023-01-04 14:31:26.408 +0000 OS Version: macOS 13.1 (22C65) Report Version: 7 Analysis Tool: /usr/bin/leaks Physical footprint: 3489K Physical footprint (peak): 3505K Idle exit: untracked ---- leaks Report Version: 4.0, multi-line stacks Process 37285: 737 nodes malloced for 110 KB Process 37285: 12 leaks for 768 total leaked bytes. STACK OF 12 INSTANCES OF 'ROOT LEAK: <calloc in main>': 2 dyld 0x193193e50 start + 2544 1 helper 0x10014fd20 main + 252 0 libsystem_malloc.dylib 0x193326dd0 _malloc_zone_calloc_instrumented_or_legacy + 228 ==== 12 (768 bytes) << TOTAL >> 1 (64 bytes) ROOT LEAK: <calloc in main 0x6000032c0000> [64] 1 (64 bytes) ROOT LEAK: <calloc in main 0x6000032c0040> [64] 1 (64 bytes) ROOT LEAK: <calloc in main 0x6000032c0080> [64] 1 (64 bytes) ROOT LEAK: <calloc in main 0x6000032c8000> [64] 1 (64 bytes) ROOT LEAK: <calloc in main 0x6000032c8080> [64] 1 (64 bytes) ROOT LEAK: <calloc in main 0x6000032c80c0> [64] 1 (64 bytes) ROOT LEAK: <calloc in main 0x6000032d0040> [64] 1 (64 bytes) ROOT LEAK: <calloc in main 0x6000032d0080> [64] 1 (64 bytes) ROOT LEAK: <calloc in main 0x6000032d0100> [64] 1 (64 bytes) ROOT LEAK: <calloc in main 0x6000032d4000> [64] 1 (64 bytes) ROOT LEAK: <calloc in main 0x6000032d8000> [64] 1 (64 bytes) ROOT LEAK: <calloc in main 0x6000032d8080> [64]
Apparently the mach buffer that communicates with the mach_server is being allocated but not free.
https://github.com/FelixKratz/dotfiles/blob/b16693a377dca608de0435ff5a2bab8568672e12/.config/sketchybar/helper/sketchybar.h#LL183
Should be solved with
while (mach_server->is_running) { struct mach_buffer* buffer = (struct mach_buffer*)malloc(sizeof(struct mach_buffer)); mach_receive_message(mach_server->port, buffer, false); mach_server->handler((env)buffer->message.descriptor.address); mach_msg_destroy(&buffer->message.header); free(buffer); }
Yes, thanks!
Noticed some small memory increase on the
helper
process. Analyzing withleaks
it's pointing some memory leaks:Apparently the mach buffer that communicates with the mach_server is being allocated but not free.
https://github.com/FelixKratz/dotfiles/blob/b16693a377dca608de0435ff5a2bab8568672e12/.config/sketchybar/helper/sketchybar.h#LL183
Should be solved with