valgrind - 总堆使用量:0个allocs,0个frees,0个字节分配

时间:2016-01-19 04:13:56

标签: valgrind

我在二进制文件上运行valgrind,即使我已经使用malloc分配了内存,也总是显示。

==13775== HEAP SUMMARY:
==13775==     in use at exit: 0 bytes in 0 blocks
==13775==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==13775== 
==13775== All heap blocks were freed -- no leaks are possible

Please let me know solution if some faced this problem previously.

1 个答案:

答案 0 :(得分:1)

通常,valgrind没有看到任何malloc / free调用是由于其中一个 原因如下:

1程序静态链接

2程序是动态链接的,但malloc / free库是静态的

3 malloc / free lib是动态的,但它是一个非标准的'库(例如tcmalloc)

由于ldd显示您有一些动态库,因此不是原因1。 所以,可能是理由2或理由3。 对于2和3,您可以使用该选项使其工作    --soname同义词= somalloc = ....

有关详细信息,请参阅用户手册

相关问题