I am profiling my source. I see some allocations that are still alive at exit when I run valgrind
.
Here is the summary:
$ valgrind --track-origins=yes --show-reachable=yes --leak-check=full $BINARY
...
==20235== LEAK SUMMARY:
==20235== definitely lost: 0 bytes in 0 blocks
==20235== indirectly lost: 0 bytes in 0 blocks
==20235== possibly lost: 0 bytes in 0 blocks
==20235== still reachable: 20,228 bytes in 37 blocks
==20235== suppressed: 0 bytes in 0 blocks
==20235==
The responsible libraries are:
dyld
: all 81 mallocs have common calls as: (no clue)
{libsystem_c, libsystem_notify, libdispatch}.dylib
: all 10 mallocs have common calls as:
localtime(...)
defined in time.h
uses tzset(...)
to initialize and return me
a struct tm*
which I shouldn't free
myself because I did not allocate it.
How do I recover these 20,228 bytes which are still reachable?
UPDATE
I am running Mac OS X