-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
valgrind shows memory leak for a simple print statement #19776
Comments
Can you run with |
|
Interesting! It looks like destructors registered with |
Let me know if you need any more information. |
This seems to be resolved, at least the program with |
@huonw did you test on linux? You may have been using the ELF TLS instead of pthread tls. I just built a compiler with
|
Ah, yes, that looks like the difference. |
It looks like this is no longer an issue (at least using nightly build of rust (1.7-0-nightly): ]$ valgrind ./learn |
This is probably OK to close then |
Ah unfortunately as I mentioned earlier this is specifically related to pthread TLS instead of ELF TLS (e.g. really old TLS). I just verified that this is indeed still an issue. |
Trying this today: $ ./configure --disable-elf-tls
$ make -j6
$ ./x86_64-unknown-linux-gnu/stage2/bin/rustc learn.rs
$ valgrind --leak-check=full ./learn
==14462== Memcheck, a memory error detector
==14462== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==14462== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==14462== Command: ./learn
==14462==
Hello World!
How are you today
==14462==
==14462== HEAP SUMMARY:
==14462== in use at exit: 0 bytes in 0 blocks
==14462== total heap usage: 22 allocs, 22 frees, 2,680 bytes allocated
==14462==
==14462== All heap blocks were freed -- no leaks are possible
==14462==
==14462== For counts of detected and suppressed errors, rerun with: -v
==14462== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
$ ./x86_64-unknown-linux-gnu/stage2/bin/rustc --version
rustc 1.10.0-dev (80bff1eea 2016-04-26) Has this been randomly fixed? |
yup, even I disabled elf-tls and it seems to have been fixed. @alexcrichton : Can we close this? |
Probably needs a test to confirm it doesn't regress. |
No, this is still an issue. The Running binaries on older systems with a working valgrind should reproduce this. |
Gah! I didn't realize the flag didn't work; I thought I was using pthread TLS. |
@alexcrichton can you cross-link to the |
that'd be #32047 |
Not sure if this is was resolved on nightly, but I see a similar issue for a trivial for a simple heap allocation testing using a bunch of Box::new() calls: valgrind-3.12.0
|
still repros just like a charm, see below (seting of
use-jemalloc=true (click to view)
use-jemalloc=false (click to view)
|
Oh, btw, the
|
That warning is harmless, and caused by LLVM optimization - see https://bugs.llvm.org//show_bug.cgi?id=23180 . |
Can compiler just optimize out condition? |
Triage: I do not have the means to attempt to reproduce today, but we did recently switch to the system allocator; I wonder if the bug persists. Anyone? |
|
Edit: Resolved with latest valgrind (3.15.0) Resolved
|
I'm running into what looks to be a related issue when trying to call a Rust function from C. According to valgrind, memory is leaked when Rust allocates the handle for $ uname -a
Linux Bastion 4.10.17-2-pve #1 SMP PVE 4.10.17-20 (Mon, 14 Aug 2017 11:23:37 +0200) x86_64 GNU/Linux
$ rustc --version
rustc 1.37.0 (eae3437df 2019-08-13)
$ gcc --version
gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 // main.c
void print_things();
void main() {
print_things();
} // lib.rs
#[no_mangle]
pub extern "C" fn print_things() {
println!("Hello, world!");
} $ LD_LIBRARY_PATH=../target/debug/ valgrind --leak-check=full --show-leak-kinds=all --trace-children=yes ./test.out
==9724== Memcheck, a memory error detector
==9724== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==9724== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==9724== Command: ./test.out
==9724==
==9724==
==9724== HEAP SUMMARY:
==9724== in use at exit: 1,200 bytes in 7 blocks
==9724== total heap usage: 8 allocs, 1 frees, 1,232 bytes allocated
==9724==
==9724== 8 bytes in 1 blocks are still reachable in loss record 1 of 7
==9724== at 0x483577F: malloc (vg_replace_malloc.c:299)
==9724== by 0x484A7F8: alloc (alloc.rs:81)
==9724== by 0x484A7F8: exchange_malloc (alloc.rs:203)
==9724== by 0x484A7F8: new<closure> (boxed.rs:113)
==9724== by 0x484A7F8: at_exit<closure> (mod.rs:123)
==9724== by 0x484A7F8: init<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>> (lazy.rs:48)
==9724== by 0x484A7F8: get<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>> (lazy.rs:34)
==9724== by 0x484A7F8: std::io::stdio::stdout (stdio.rs:470)
==9724== by 0x484AF17: {{closure}}<std::io::stdio::Stdout> (stdio.rs:786)
==9724== by 0x484AF17: try_with<core::cell::RefCell<core::option::Option<alloc::boxed::Box<Write>>>,closure,core::result::Result<(), std::io::error::Error>> (local.rs:299)
==9724== by 0x484AF17: print_to<std::io::stdio::Stdout> (stdio.rs:780)
==9724== by 0x484AF17: std::io::stdio::_print (stdio.rs:802)
==9724== by 0x48475A3: print_things (lib.rs:3)
==9724== by 0x1086CD: main (in /home/proxmox/Projects/test-things/src/test.out)
==9724==
==9724== 8 bytes in 1 blocks are still reachable in loss record 2 of 7
==9724== at 0x483577F: malloc (vg_replace_malloc.c:299)
==9724== by 0x484A973: alloc (alloc.rs:81)
==9724== by 0x484A973: exchange_malloc (alloc.rs:203)
==9724== by 0x484A973: new<alloc::sync::Arc<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>>> (boxed.rs:113)
==9724== by 0x484A973: init<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>> (lazy.rs:60)
==9724== by 0x484A973: get<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>> (lazy.rs:34)
==9724== by 0x484A973: std::io::stdio::stdout (stdio.rs:470)
==9724== by 0x484AF17: {{closure}}<std::io::stdio::Stdout> (stdio.rs:786)
==9724== by 0x484AF17: try_with<core::cell::RefCell<core::option::Option<alloc::boxed::Box<Write>>>,closure,core::result::Result<(), std::io::error::Error>> (local.rs:299)
==9724== by 0x484AF17: print_to<std::io::stdio::Stdout> (stdio.rs:780)
==9724== by 0x484AF17: std::io::stdio::_print (stdio.rs:802)
==9724== by 0x48475A3: print_things (lib.rs:3)
==9724== by 0x1086CD: main (in /home/proxmox/Projects/test-things/src/test.out)
==9724==
==9724== 16 bytes in 1 blocks are still reachable in loss record 3 of 7
==9724== at 0x483577F: malloc (vg_replace_malloc.c:299)
==9724== by 0x484CA25: alloc (alloc.rs:81)
==9724== by 0x484CA25: alloc (alloc.rs:169)
==9724== by 0x484CA25: reserve_internal<alloc::boxed::Box<FnOnce<()>>,alloc::alloc::Global> (raw_vec.rs:668)
==9724== by 0x484CA25: reserve<alloc::boxed::Box<FnOnce<()>>,alloc::alloc::Global> (raw_vec.rs:491)
==9724== by 0x484CA25: reserve<alloc::boxed::Box<FnOnce<()>>> (vec.rs:457)
==9724== by 0x484CA25: push<alloc::boxed::Box<FnOnce<()>>> (vec.rs:1033)
==9724== by 0x484CA25: std::sys_common::at_exit_imp::push (at_exit_imp.rs:69)
==9724== by 0x484A813: at_exit<closure> (mod.rs:123)
==9724== by 0x484A813: init<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>> (lazy.rs:48)
==9724== by 0x484A813: get<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>> (lazy.rs:34)
==9724== by 0x484A813: std::io::stdio::stdout (stdio.rs:470)
==9724== by 0x484AF17: {{closure}}<std::io::stdio::Stdout> (stdio.rs:786)
==9724== by 0x484AF17: try_with<core::cell::RefCell<core::option::Option<alloc::boxed::Box<Write>>>,closure,core::result::Result<(), std::io::error::Error>> (local.rs:299)
==9724== by 0x484AF17: print_to<std::io::stdio::Stdout> (stdio.rs:780)
==9724== by 0x484AF17: std::io::stdio::_print (stdio.rs:802)
==9724== by 0x48475A3: print_things (lib.rs:3)
==9724== by 0x1086CD: main (in /home/proxmox/Projects/test-things/src/test.out)
==9724==
==9724== 24 bytes in 1 blocks are still reachable in loss record 4 of 7
==9724== at 0x483577F: malloc (vg_replace_malloc.c:299)
==9724== by 0x484C94A: alloc (alloc.rs:81)
==9724== by 0x484C94A: exchange_malloc (alloc.rs:203)
==9724== by 0x484C94A: init (at_exit_imp.rs:30)
==9724== by 0x484C94A: std::sys_common::at_exit_imp::push (at_exit_imp.rs:66)
==9724== by 0x484A813: at_exit<closure> (mod.rs:123)
==9724== by 0x484A813: init<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>> (lazy.rs:48)
==9724== by 0x484A813: get<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>> (lazy.rs:34)
==9724== by 0x484A813: std::io::stdio::stdout (stdio.rs:470)
==9724== by 0x484AF17: {{closure}}<std::io::stdio::Stdout> (stdio.rs:786)
==9724== by 0x484AF17: try_with<core::cell::RefCell<core::option::Option<alloc::boxed::Box<Write>>>,closure,core::result::Result<(), std::io::error::Error>> (local.rs:299)
==9724== by 0x484AF17: print_to<std::io::stdio::Stdout> (stdio.rs:780)
==9724== by 0x484AF17: std::io::stdio::_print (stdio.rs:802)
==9724== by 0x48475A3: print_things (lib.rs:3)
==9724== by 0x1086CD: main (in /home/proxmox/Projects/test-things/src/test.out)
==9724==
==9724== 40 bytes in 1 blocks are still reachable in loss record 5 of 7
==9724== at 0x483577F: malloc (vg_replace_malloc.c:299)
==9724== by 0x484A862: alloc (alloc.rs:81)
==9724== by 0x484A862: exchange_malloc (alloc.rs:203)
==9724== by 0x484A862: new<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>> (remutex.rs:54)
==9724== by 0x484A862: stdout_init (stdio.rs:480)
==9724== by 0x484A862: init<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>> (lazy.rs:58)
==9724== by 0x484A862: get<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>> (lazy.rs:34)
==9724== by 0x484A862: std::io::stdio::stdout (stdio.rs:470)
==9724== by 0x484AF17: {{closure}}<std::io::stdio::Stdout> (stdio.rs:786)
==9724== by 0x484AF17: try_with<core::cell::RefCell<core::option::Option<alloc::boxed::Box<Write>>>,closure,core::result::Result<(), std::io::error::Error>> (local.rs:299)
==9724== by 0x484AF17: print_to<std::io::stdio::Stdout> (stdio.rs:780)
==9724== by 0x484AF17: std::io::stdio::_print (stdio.rs:802)
==9724== by 0x48475A3: print_things (lib.rs:3)
==9724== by 0x1086CD: main (in /home/proxmox/Projects/test-things/src/test.out)
==9724==
==9724== 80 bytes in 1 blocks are still reachable in loss record 6 of 7
==9724== at 0x483577F: malloc (vg_replace_malloc.c:299)
==9724== by 0x484A8DE: alloc (alloc.rs:81)
==9724== by 0x484A8DE: exchange_malloc (alloc.rs:203)
==9724== by 0x484A8DE: new<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>> (sync.rs:288)
==9724== by 0x484A8DE: stdout_init (stdio.rs:480)
==9724== by 0x484A8DE: init<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>> (lazy.rs:58)
==9724== by 0x484A8DE: get<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>> (lazy.rs:34)
==9724== by 0x484A8DE: std::io::stdio::stdout (stdio.rs:470)
==9724== by 0x484AF17: {{closure}}<std::io::stdio::Stdout> (stdio.rs:786)
==9724== by 0x484AF17: try_with<core::cell::RefCell<core::option::Option<alloc::boxed::Box<Write>>>,closure,core::result::Result<(), std::io::error::Error>> (local.rs:299)
==9724== by 0x484AF17: print_to<std::io::stdio::Stdout> (stdio.rs:780)
==9724== by 0x484AF17: std::io::stdio::_print (stdio.rs:802)
==9724== by 0x48475A3: print_things (lib.rs:3)
==9724== by 0x1086CD: main (in /home/proxmox/Projects/test-things/src/test.out)
==9724==
==9724== 1,024 bytes in 1 blocks are still reachable in loss record 7 of 7
==9724== at 0x483577F: malloc (vg_replace_malloc.c:299)
==9724== by 0x484A826: alloc (alloc.rs:81)
==9724== by 0x484A826: alloc (alloc.rs:169)
==9724== by 0x484A826: allocate_in<u8,alloc::alloc::Global> (raw_vec.rs:95)
==9724== by 0x484A826: with_capacity<u8> (raw_vec.rs:139)
==9724== by 0x484A826: with_capacity<u8> (vec.rs:355)
==9724== by 0x484A826: with_capacity<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>> (buffered.rs:484)
==9724== by 0x484A826: with_capacity<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>> (buffered.rs:857)
==9724== by 0x484A826: new<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>> (buffered.rs:836)
==9724== by 0x484A826: stdout_init (stdio.rs:480)
==9724== by 0x484A826: init<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>> (lazy.rs:58)
==9724== by 0x484A826: get<std::sys_common::remutex::ReentrantMutex<core::cell::RefCell<std::io::buffered::LineWriter<std::io::stdio::Maybe<std::io::stdio::StdoutRaw>>>>> (lazy.rs:34)
==9724== by 0x484A826: std::io::stdio::stdout (stdio.rs:470)
==9724== by 0x484AF17: {{closure}}<std::io::stdio::Stdout> (stdio.rs:786)
==9724== by 0x484AF17: try_with<core::cell::RefCell<core::option::Option<alloc::boxed::Box<Write>>>,closure,core::result::Result<(), std::io::error::Error>> (local.rs:299)
==9724== by 0x484AF17: print_to<std::io::stdio::Stdout> (stdio.rs:780)
==9724== by 0x484AF17: std::io::stdio::_print (stdio.rs:802)
==9724== by 0x48475A3: print_things (lib.rs:3)
==9724== by 0x1086CD: main (in /home/proxmox/Projects/test-things/src/test.out)
==9724==
==9724== LEAK SUMMARY:
==9724== definitely lost: 0 bytes in 0 blocks
==9724== indirectly lost: 0 bytes in 0 blocks
==9724== possibly lost: 0 bytes in 0 blocks
==9724== still reachable: 1,200 bytes in 7 blocks
==9724== suppressed: 0 bytes in 0 blocks
==9724==
==9724== For counts of detected and suppressed errors, rerun with: -v
==9724== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) |
I'm encountering the same behaviour with Rust -> C -> C++
#[no_mangle]
pub extern "C" fn print_something() {
eprintln!("something");
} int main() {
print_something();
return 0;
} RUSTFLAGS="-g -C opt-level=0" cargo build
g++ main.cpp -L ./target/debug/ -lfinalfusion_tf -o run -g -O0
valgrind --leak-check=full --show-leak-kinds=all --trace-children=yes ./run
|
Still seeing this in 1.41.1, same test program as my previous comment. What would be needed to resolve this issue? Is there a workaround that can be done or just avoid using stdout/stderr in Rust code called from C?
|
How do those 7 allocations negatively impact your program? |
Mostly personal curiosity since I don't know a whole lot about what's causing this. But also my company has been considering allowing us to use Rust with our existing C codebase and management tends to focus pretty hard on any kind of memory leak occurring. |
It seems that when we call println first time, it register a closure to drop the resource at the end of the program. Lines 43 to 53 in 02046a5
If we call println from normal Rust program, lang_start_internal execute that closure at the end and memory freed. Line 55 in 3982d35
rust/src/libstd/sys_common/mod.rs Line 130 in 02046a5
rust/src/libstd/sys_common/at_exit_imp.rs Line 40 in 02046a5
But if we call it from C program, lang_start_internal will not be executed and registered closures will not be executed too and the resource will be leaked. |
It looks like, this problem is still alive. ~/leak ❯ valgrind --version
valgrind-3.16.0.GIT ~/leak ❯ rustc --version
rustc 1.33.0 ~/leak ❯ uname -a
Darwin x.local 19.5.0 Darwin Kernel Version 19.5.0: Thu Apr 30 18:25:59 PDT 2020; root:xnu-6153.121.1~7/RELEASE_X86_64 x86_64 ~/leak ❯ cat src/main.rs
fn main() {
println!("Hello World!");
println!("How are you today");
} ~/leak ❯ rustc src/main.rs && valgrind --leak-check=full --show-reachable=yes ./main
==2304== Memcheck, a memory error detector
==2304== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2304== Using Valgrind-3.16.0.GIT and LibVEX; rerun with -h for copyright info
==2304== Command: ./main
==2304==
Hello World!
How are you today
==2304==
==2304== HEAP SUMMARY:
==2304== in use at exit: 14,803 bytes in 163 blocks
==2304== total heap usage: 191 allocs, 28 frees, 21,036 bytes allocated
==2304==
==2304== 14 bytes in 1 blocks are still reachable in loss record 1 of 38
==2304== at 0x100157635: malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x1004362AA: __setenv_locked (in /usr/lib/system/libsystem_c.dylib)
==2304== by 0x1004366A3: setenv (in /usr/lib/system/libsystem_c.dylib)
==2304== by 0x1006D83E6: _libxpc_initializer (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1001637A0: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x10006100A: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x100060F75: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F013: ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F0B3: ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==2304== by 0x10004D59F: dyld::initializeMainExecutable() (in /usr/lib/dyld)
==2304==
==2304== 16 bytes in 1 blocks are indirectly lost in loss record 2 of 38
==2304== at 0x100157E51: malloc_zone_calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10073E29D: copySwiftV1MangledName(char const*, bool) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073DFFC: _getObjc2ProtocolList(header_info const*, unsigned long*) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073C96E: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304==
==2304== 32 bytes in 1 blocks are indirectly lost in loss record 3 of 38
==2304== at 0x100157635: malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10073E21B: _NXMapMember(_NXMapTable*, void const*, void**) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073DFFC: _getObjc2ProtocolList(header_info const*, unsigned long*) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073C96E: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304==
==2304== 32 bytes in 1 blocks are indirectly lost in loss record 4 of 38
==2304== at 0x100157635: malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10073E04F: _getObjc2ProtocolList(header_info const*, unsigned long*) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073C96E: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304==
==2304== 32 bytes in 1 blocks are definitely lost in loss record 5 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x1007515F3: objc::DenseMap<objc_class*, objc_class*, objc::DenseMapValueInfo<objc_class*>, objc::DenseMapInfo<objc_class*>, objc::detail::DenseMapPair<objc_class*, objc_class*> >::grow(unsigned int) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075169F: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075169F: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073D406: objc_opt::objc_stringhash_t::getIndex(char const*) const (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304==
==2304== 32 bytes in 1 blocks are definitely lost in loss record 6 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x1007515F3: objc::DenseMap<objc_class*, objc_class*, objc::DenseMapValueInfo<objc_class*>, objc::DenseMapInfo<objc_class*>, objc::detail::DenseMapPair<objc_class*, objc_class*> >::grow(unsigned int) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075169F: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075169F: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075169F: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073D406: objc_opt::objc_stringhash_t::getIndex(char const*) const (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304==
==2304== 32 bytes in 1 blocks are definitely lost in loss record 7 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x1007515F3: objc::DenseMap<objc_class*, objc_class*, objc::DenseMapValueInfo<objc_class*>, objc::DenseMapInfo<objc_class*>, objc::detail::DenseMapPair<objc_class*, objc_class*> >::grow(unsigned int) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1007516C6: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075169F: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075169F: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075169F: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073D406: objc_opt::objc_stringhash_t::getIndex(char const*) const (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304==
==2304== 32 bytes in 1 blocks are definitely lost in loss record 8 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x1007515F3: objc::DenseMap<objc_class*, objc_class*, objc::DenseMapValueInfo<objc_class*>, objc::DenseMapInfo<objc_class*>, objc::detail::DenseMapPair<objc_class*, objc_class*> >::grow(unsigned int) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1007516C6: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075169F: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075169F: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073D406: objc_opt::objc_stringhash_t::getIndex(char const*) const (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304==
==2304== 48 bytes in 1 blocks are still reachable in loss record 9 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x100740667: objc_msgSend_stret (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298FEC: _os_object_alloc_realized (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1006D852B: xpc_array_create (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D7F85: _libxpc_initializer (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1001637A0: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x10006100A: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x100060F75: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F013: ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F0B3: ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==2304==
==2304== 48 bytes in 1 blocks are indirectly lost in loss record 10 of 38
==2304== at 0x100157E51: malloc_zone_calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10073E5F2: _mapStrIsEqual(_NXMapTable*, void const*, void const*) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073E57C: NXMapInsert (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073E23D: _mapStrHash(_NXMapTable*, void const*) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073DFFC: _getObjc2ProtocolList(header_info const*, unsigned long*) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073C96E: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304==
==2304== 64 bytes in 1 blocks are still reachable in loss record 11 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x1006D859B: _xpc_calloc (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D8542: xpc_array_create (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D7F85: _libxpc_initializer (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1001637A0: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x10006100A: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x100060F75: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F013: ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F0B3: ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==2304== by 0x10004D59F: dyld::initializeMainExecutable() (in /usr/lib/dyld)
==2304==
==2304== 64 bytes in 1 blocks are still reachable in loss record 12 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x100740667: objc_msgSend_stret (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298FEC: _os_object_alloc_realized (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1006EEB3A: _xpc_pipe_create (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D8614: _xpc_create_bootstrap_pipe (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D832D: _libxpc_initializer (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1001637A0: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x10006100A: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x100060F75: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F013: ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304==
==2304== 64 bytes in 1 blocks are indirectly lost in loss record 13 of 38
==2304== at 0x100157635: malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x100435FB5: _owned_ptr_alloc (in /usr/lib/system/libsystem_c.dylib)
==2304== by 0x100436675: setenv (in /usr/lib/system/libsystem_c.dylib)
==2304== by 0x1006D83E6: _libxpc_initializer (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1001637A0: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x10006100A: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x100060F75: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F013: ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F0B3: ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==2304== by 0x10004D59F: dyld::initializeMainExecutable() (in /usr/lib/dyld)
==2304==
==2304== 80 (32 direct, 48 indirect) bytes in 1 blocks are definitely lost in loss record 14 of 38
==2304== at 0x1001578AA: malloc_zone_malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10073E14F: _NXMapMember(_NXMapTable*, void const*, void**) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073DFFC: _getObjc2ProtocolList(header_info const*, unsigned long*) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073C96E: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304==
==2304== 80 (32 direct, 48 indirect) bytes in 1 blocks are definitely lost in loss record 15 of 38
==2304== at 0x1001578AA: malloc_zone_malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10073E170: _NXMapMember(_NXMapTable*, void const*, void**) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073DFFC: _getObjc2ProtocolList(header_info const*, unsigned long*) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073C96E: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304==
==2304== 80 (16 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 16 of 38
==2304== at 0x100157635: malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x100435FA3: _owned_ptr_alloc (in /usr/lib/system/libsystem_c.dylib)
==2304== by 0x100436675: setenv (in /usr/lib/system/libsystem_c.dylib)
==2304== by 0x1006D83E6: _libxpc_initializer (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1001637A0: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x10006100A: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x100060F75: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F013: ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F0B3: ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==2304== by 0x10004D59F: dyld::initializeMainExecutable() (in /usr/lib/dyld)
==2304==
==2304== 128 bytes in 1 blocks are definitely lost in loss record 17 of 38
==2304== at 0x100157635: malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x100316801: tlv_load_notification (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10004F64F: dyld::registerAddCallback(void (*)(mach_header const*, long)) (in /usr/lib/dyld)
==2304== by 0x100315E7A: _dyld_register_func_for_add_image (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10032E41A: _dyld_initializer (in /usr/lib/system/libdyld.dylib)
==2304== by 0x100163780: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x10006100A: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x100060F75: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F013: ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F0B3: ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==2304==
==2304== 128 bytes in 1 blocks are definitely lost in loss record 18 of 38
==2304== at 0x100157FD6: realloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10075A752: int sliceRequiresGC<Arch32>(Arch32::mh_t, FileSlice) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073C299: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304==
==2304== 128 bytes in 1 blocks are definitely lost in loss record 19 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x100740667: objc_msgSend_stret (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298FEC: _os_object_alloc_realized (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x10029DBC5: _dispatch_lane_create_with_target (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1006A05F5: _libtrace_init (in /usr/lib/system/libsystem_trace.dylib)
==2304== by 0x1001637B0: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x10006100A: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x100060F75: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F013: ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F0B3: ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==2304==
==2304== 128 bytes in 4 blocks are definitely lost in loss record 20 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x1007515F3: objc::DenseMap<objc_class*, objc_class*, objc::DenseMapValueInfo<objc_class*>, objc::DenseMapInfo<objc_class*>, objc::detail::DenseMapPair<objc_class*, objc_class*> >::grow(unsigned int) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075169F: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073D406: objc_opt::objc_stringhash_t::getIndex(char const*) const (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304==
==2304== 128 bytes in 4 blocks are definitely lost in loss record 21 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x1007515F3: objc::DenseMap<objc_class*, objc_class*, objc::DenseMapValueInfo<objc_class*>, objc::DenseMapInfo<objc_class*>, objc::detail::DenseMapPair<objc_class*, objc_class*> >::grow(unsigned int) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1007516C6: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075169F: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073D406: objc_opt::objc_stringhash_t::getIndex(char const*) const (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304==
==2304== 152 bytes in 1 blocks are still reachable in loss record 22 of 38
==2304== at 0x100157635: malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10032212F: tlv_allocate_and_initialize_for_key (in /usr/lib/system/libdyld.dylib)
==2304== by 0x100321F67: tlv_get_addr (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10000873E: std::sys_common::thread_info::THREAD_INFO::__getit (cell.rs:249)
==2304== by 0x1000089AF: <std::thread::local::LocalKey<T>>::with (local.rs:296)
==2304== by 0x1000027DD: std::rt::lang_start_internal (thread_info.rs:37)
==2304== by 0x1000018B1: std::rt::lang_start (in ./main)
==2304== by 0x100001971: main (in ./main)
==2304==
==2304== 252 bytes in 2 blocks are indirectly lost in loss record 23 of 38
==2304== at 0x100157635: malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x1006D8CA6: _xpc_malloc (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D8B81: _xpc_dictionary_insert (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D8F27: _xpc_dyld_image_callback (in /usr/lib/system/libxpc.dylib)
==2304== by 0x10004F8DA: dyld::registerBulkLoadCallback(void (*)(unsigned int, mach_header const**, char const**)) (in /usr/lib/dyld)
==2304== by 0x1006D8DBA: _xpc_collect_images (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D8337: _libxpc_initializer (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1001637A0: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x10006100A: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x100060F75: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304==
==2304== 288 bytes in 6 blocks are indirectly lost in loss record 24 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x100740667: objc_msgSend_stret (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298FEC: _os_object_alloc_realized (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1006F4D46: _xpc_string_create (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D88CF: xpc_dictionary_set_string (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D8725: _xpc_collect_environment (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D8332: _libxpc_initializer (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1001637A0: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x10006100A: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x100060F75: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304==
==2304== 300 bytes in 6 blocks are indirectly lost in loss record 25 of 38
==2304== at 0x100157635: malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x1006D8CA6: _xpc_malloc (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D8B81: _xpc_dictionary_insert (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D88E0: xpc_dictionary_set_string (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D8725: _xpc_collect_environment (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D8332: _libxpc_initializer (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1001637A0: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x10006100A: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x100060F75: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F013: ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304==
==2304== 348 (96 direct, 252 indirect) bytes in 1 blocks are definitely lost in loss record 26 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x100740667: objc_msgSend_stret (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298FEC: _os_object_alloc_realized (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1006D8877: xpc_dictionary_create (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D8EA2: _xpc_dyld_image_callback (in /usr/lib/system/libxpc.dylib)
==2304== by 0x10004F8DA: dyld::registerBulkLoadCallback(void (*)(unsigned int, mach_header const**, char const**)) (in /usr/lib/dyld)
==2304== by 0x1006D8DBA: _xpc_collect_images (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D8337: _libxpc_initializer (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1001637A0: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x10006100A: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304==
==2304== 352 bytes in 4 blocks are indirectly lost in loss record 27 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10073C049: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304==
==2304== 440 (88 direct, 352 indirect) bytes in 1 blocks are definitely lost in loss record 28 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10073C049: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304==
==2304== 925 bytes in 6 blocks are indirectly lost in loss record 29 of 38
==2304== at 0x100157635: malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10042DCE5: strdup (in /usr/lib/system/libsystem_c.dylib)
==2304== by 0x1006D88FD: xpc_string_create (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D88CF: xpc_dictionary_set_string (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D8725: _xpc_collect_environment (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D8332: _libxpc_initializer (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1001637A0: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x10006100A: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x100060F75: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F013: ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304==
==2304== 1,536 bytes in 1 blocks are definitely lost in loss record 30 of 38
==2304== at 0x100157635: malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10073BCBA: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x10006100A: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x100060F75: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F013: ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F0B3: ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) (in /usr/lib/dyld)
==2304== by 0x10004D59F: dyld::initializeMainExecutable() (in /usr/lib/dyld)
==2304==
==2304== 1,609 (96 direct, 1,513 indirect) bytes in 1 blocks are definitely lost in loss record 31 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x100740667: objc_msgSend_stret (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298FEC: _os_object_alloc_realized (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1006D8877: xpc_dictionary_create (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D86F9: _xpc_collect_environment (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1006D8332: _libxpc_initializer (in /usr/lib/system/libxpc.dylib)
==2304== by 0x1001637A0: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x1000665ED: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304== by 0x10006100A: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x100060F75: ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304== by 0x10005F013: ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) (in /usr/lib/dyld)
==2304==
==2304== 1,632 bytes in 51 blocks are definitely lost in loss record 32 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x1007515F3: objc::DenseMap<objc_class*, objc_class*, objc::DenseMapValueInfo<objc_class*>, objc::DenseMapInfo<objc_class*>, objc::detail::DenseMapPair<objc_class*, objc_class*> >::grow(unsigned int) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073D406: objc_opt::objc_stringhash_t::getIndex(char const*) const (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304==
==2304== 1,632 bytes in 51 blocks are definitely lost in loss record 33 of 38
==2304== at 0x100157C90: calloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x1007515F3: objc::DenseMap<objc_class*, objc_class*, objc::DenseMapValueInfo<objc_class*>, objc::DenseMapInfo<objc_class*>, objc::detail::DenseMapPair<objc_class*, objc_class*> >::grow(unsigned int) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1007516C6: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073D406: objc_opt::objc_stringhash_t::getIndex(char const*) const (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304==
==2304== 2,048 bytes in 1 blocks are still reachable in loss record 34 of 38
==2304== at 0x100157635: malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x100757E95: class_setWeakIvarLayout (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100757E26: class_setWeakIvarLayout (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075BBF9: _objc_atfork_parent (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100749742: property_copyAttributeList (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073F1E7: NXMapRemove (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100751BD2: attachCategories(objc_class*, locstamped_category_t const*, unsigned int, int) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1007516C6: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075169F: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075169F: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10075169F: objc_class::mangledName() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073D406: objc_opt::objc_stringhash_t::getIndex(char const*) const (in /usr/lib/libobjc.A.dylib)
==2304==
==2304== 2,064 bytes in 1 blocks are indirectly lost in loss record 35 of 38
==2304== at 0x1001578AA: malloc_zone_malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10073E0B5: getProtocol(char const*) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073C96E: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304==
==2304== 2,064 bytes in 1 blocks are indirectly lost in loss record 36 of 38
==2304== at 0x1001578AA: malloc_zone_malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10073F01E: NXMapRemove (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073EEA5: search_method_list(method_list_t const*, objc_selector*) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073D0DD: _getObjc2MessageRefs(header_info const*, unsigned long*) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304==
==2304== 2,088 (24 direct, 2,064 indirect) bytes in 1 blocks are definitely lost in loss record 37 of 38
==2304== at 0x1001578AA: malloc_zone_malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10073DFCC: protocols() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073E959: prepareMethodLists(objc_class*, method_list_t**, int, bool, bool) (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073CEF6: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304==
==2304== 2,120 (24 direct, 2,096 indirect) bytes in 1 blocks are definitely lost in loss record 38 of 38
==2304== at 0x1001578AA: malloc_zone_malloc (in /usr/local/Cellar/valgrind/HEAD-36f444c/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==2304== by 0x10073DFCC: protocols() (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10073C96E: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x10074D2D0: unmap_image (in /usr/lib/libobjc.A.dylib)
==2304== by 0x1000505A5: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==2304== by 0x100050746: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==2304== by 0x100316AD0: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==2304== by 0x10073BDAF: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==2304== by 0x100298F38: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x1002A50E7: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==2304== by 0x100163790: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==2304== by 0x1000661E2: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==2304==
==2304== LEAK SUMMARY:
==2304== definitely lost: 5,976 bytes in 126 blocks
==2304== indirectly lost: 6,437 bytes in 31 blocks
==2304== possibly lost: 0 bytes in 0 blocks
==2304== still reachable: 2,390 bytes in 6 blocks
==2304== suppressed: 0 bytes in 0 blocks
==2304==
==2304== For lists of detected and suppressed errors, rerun with: -s
==2304== ERROR SUMMARY: 20 errors from 20 contexts (suppressed: 1 from 1)
~/leak ❯ |
Is this report about leakages that could lead to unconstrained memory usage or just memory that was allocated for the entire lifespan of the process on purpose? Based on what I have been reading, Valgrind does not fully differentiate between the two, and only seems to sense bytes that have not been deliberately cleaned up at the end, but we should expect perpetual allocation in some cases, and that leaving it to the system can actually be better than bothering to run a destructor if the destructor was trivial, thus consuming active program cycles before termination even when it would be equally safe to leave it to the system. Even OWASP mentions this is not a problem in short-lived userland applications. According to the Valgrind FAQ, for the "still reachable" reports:
I am puzzled by the last report here, since it is actually quite severe by comparison, but it seems all the leaks detected are actually inside MacOS libraries and thus things we cannot do much about. |
133: Fix use-after-free and 3 memory leaks; enforce AddressSanitizer in CI r=Bromeon a=Bromeon Changes implementation of the `Gd` smart pointer to cache the instance ID in each object. To my knowledge, instance IDs are the only reliable way to check for object validity in Godot, as raw object pointers may become dangling. In addition, this PR fixes 3 memory leaks around arrays and dictionaries. Those occurred due to `from_sys_init()` using `T::default()` in too many places. This essentially lead to allocating a default-constructed object, which is then immediately overwritten by the `init` function, which _also_ allocates a new object. I refactored the `GodotFfi::from_sys_init()` to **never** call `default()`, and add an explicit `from_sys_init_default()` for cases where this is desired. This also cuts down on some of the boilerplate. --- Both use-after-free and memory leaks were discovered using AddressSanitizer/LeakSanitizer. Great tooling from the C++ world, which also proves useful for us, as miri can't be used in FFI contexts. From now on, UB or leaks detected by ASan/LSan will cause a hard error in CI. The tools are not 100% bullet-proof; they didn't detect the following UAF case in a short test, but they are still of great value as a more systematic counter to memory errors. <details><summary>use-after-free, false negative</summary> ```rs let mut boks = Box::new(44); let ptr = std::ptr::addr_of_mut!(*boks); println!("deref={}", unsafe { *ptr }); // output: deref=44 drop(boks); println!("deref={}", unsafe { *ptr }); // output: deref=1719666059 ``` </details> On a side note, getting these working correctly in CI was a bit of a marathon because ASan/LSan don't have stacktraces for dynamically loaded libraries (a known wontfix problem, see google/sanitizers#89). Additionally, false positives for memory leaks were reported: a simple `println!` would cause 1024 bytes of non-reclaimable memory. Therefore, I had to compile a special version of nightly Godot that disables dynamic library unloading via `dlclose`, to keep the stacktrace around, and this seemed to fix the false-positive issue as well. Although likely unrelated, what I also found during research was rust-lang/rust#19776. Fixes #89. Co-authored-by: Jan Haller <[email protected]>
Seems there are no leaks on my 64-bit Linux machine with rustc 1.75.0-nightly (249624b 2023-10-20):
@inancgumus would you be willing to test once more on your machine with nightly rustc? |
I think Valgrind version might be more important than Rustc version. |
Thank you @istankovic. Then, considering also what @mati865 said, I think it is safe to close this. |
Here are the details:
$ valgrind --version
valgrind-3.8.1
rustc --version
rustc 0.13.0-nightly (193390d 2014-12-11 22:56:54 +0000)
uname -a
Linux 2.6.32-504.1.3.el6.x86_64 #1 SMP Tue Nov 11 17:57:25 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Here is the program:
$ cat learn.rs
fn main() {
println!("Hello World!")
println!("How are you today")
}
$ valgrind --leak-check=full ./learn
==38235== Memcheck, a memory error detector
==38235== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==38235== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==38235== Command: ./learn
==38235==
Hello World!
How are you today
==38235==
==38235== HEAP SUMMARY:
==38235== in use at exit: 1,184 bytes in 4 blocks
==38235== total heap usage: 18 allocs, 14 frees, 2,696 bytes allocated
==38235==
==38235== LEAK SUMMARY:
==38235== definitely lost: 0 bytes in 0 blocks
==38235== indirectly lost: 0 bytes in 0 blocks
==38235== possibly lost: 0 bytes in 0 blocks
==38235== still reachable: 1,184 bytes in 4 blocks
==38235== suppressed: 0 bytes in 0 blocks
==38235== Reachable blocks (those to which a pointer was found) are not shown.
==38235== To see them, rerun with: --leak-check=full --show-reachable=yes
==38235==
==38235== For counts of detected and suppressed errors, rerun with: -v
==38235== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6)
The text was updated successfully, but these errors were encountered: