Valgrind showing memory leak for printf and unused blocks

元气小坏坏 提交于 2019-11-27 16:07:47

Until the Valgrind team prioritizes OS X, you can safely assume that it will not give correct results on Apple systems running OS X versions newer than 10.7.

On my Mavericks (10.9.5) machine, I still get the following warning from Valgrind (3.9.0)

WARNING: Support on MacOS 10.8/10.9 is experimental and mostly broken.
WARNING: Expect incorrect results, assertions and crashes.
WARNING: In particular, Memcheck on 32-bit programs will fail to
WARNING: detect any errors associated with heap-allocated data.

For what it's worth, Valgrind 3.10.0 shows no leaks on my Debian Jessie installation.

abligh

It isn't telling you that there is a leak:

==77215== LEAK SUMMARY:
==77215==    definitely lost: 0 bytes in 0 blocks
==77215==    indirectly lost: 0 bytes in 0 blocks
==77215==      possibly lost: 0 bytes in 0 blocks
==77215==    still reachable: 4,096 bytes in 1 blocks
==77215==         suppressed: 25,115 bytes in 373 blocks

it's telling you that there is a block which is still reachable; whether or not there is a leak is dependent on your definition of 'leak'. What it does mean is that there is a pointer to the block somewhere.

Refer to Still Reachable Leak detected by Valgrind for more information.

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