I am running Rust 1.4.0 on OS X 10.10.5 and tried the sample code at http://rustbyexample.com/scope/raii.html. I built Valgrind 3.11.0 on OS X.
pastoraleman@macbook:~/projects/rust$ ../valgrind/bin/valgrind --leak-check=full --show-leak-kinds=all ./raii
==29556== Memcheck, a memory error detector
==29556== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==29556== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==29556== Command: ./raii
==29556==
==29556==
==29556== HEAP SUMMARY:
==29556== in use at exit: 35,053 bytes in 426 blocks
==29556== total heap usage: 507 allocs, 81 frees, 41,205 bytes allocated
==29556==
==29556== 104 bytes in 1 blocks are still reachable in loss record 46 of 82
==29556== at 0x100043EA1: malloc (vg_replace_malloc.c:303)
==29556== by 0x10017BD9F: tlv_allocate_and_initialize_for_key (in /usr/lib/system/libdyld.dylib)
==29556== by 0x10017C548: tlv_get_addr (in /usr/lib/system/libdyld.dylib)
==29556== by 0x1000021C9: sys_common::thread_info::set::hbb3014f373adf259zUr (in ./raii)
==29556== by 0x1000061DC: rt::lang_start::hf0f318bf9acb9103hUw (in ./raii)
==29556== by 0x100000D99: main (in ./raii)
==29556==
==29556== LEAK SUMMARY:
==29556== definitely lost: 0 bytes in 0 blocks
==29556== indirectly lost: 0 bytes in 0 blocks
==29556== possibly lost: 0 bytes in 0 blocks
==29556== still reachable: 104 bytes in 1 blocks
==29556== suppressed: 34,949 bytes in 425 blocks
==29556==
==29556== For counts of detected and suppressed errors, rerun with: -v
==29556== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 17 from 17)
The Valgrind FAQ says that the "still reachable" entries are probably OK, but from the raii example code I was expecting to see "All heap blocks were freed -- no leaks are possible". Am I doing something wrong, is this typical behaviour on OS X, or perhaps something else?
Many thanks.