How to resolve dyld and localtime leaks when profiling a project?

时光总嘲笑我的痴心妄想 提交于 2020-01-04 03:23:12

问题


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

来源:https://stackoverflow.com/questions/10105181/how-to-resolve-dyld-and-localtime-leaks-when-profiling-a-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!