Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/163.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 我仍然有内存泄漏吗?(瓦尔格林)_C++_Memory Leaks_Valgrind - Fatal编程技术网

C++ 我仍然有内存泄漏吗?(瓦尔格林)

C++ 我仍然有内存泄漏吗?(瓦尔格林),c++,memory-leaks,valgrind,C++,Memory Leaks,Valgrind,我的代码中有很多内存泄漏,我修复了一些,valgrind现在给出了这个,这与我以前的不同 根据stackoverflow的帖子,如果我没有内存泄漏,这就是我应该得到的: HEAP SUMMARY: in use at exit: 0 bytes in 0 blocks total heap usage: 636 allocs, 636 frees, 25,393 bytes allocated All heap blocks were freed -- no leaks are p

我的代码中有很多内存泄漏,我修复了一些,valgrind现在给出了这个,这与我以前的不同

根据stackoverflow的帖子,如果我没有内存泄漏,这就是我应该得到的:

HEAP SUMMARY:
    in use at exit: 0 bytes in 0 blocks
  total heap usage: 636 allocs, 636 frees, 25,393 bytes allocated

All heap blocks were freed -- no leaks are possible

ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

但我明白了:

==19608== HEAP SUMMARY:
==19608==     in use at exit: 326,220 bytes in 2,863 blocks
==19608==   total heap usage: 82,856 allocs, 79,994 frees, 25,964,400 bytes allocated
==19608== 
==19608== LEAK SUMMARY:
==19608==    definitely lost: 0 bytes in 0 blocks
==19608==    indirectly lost: 0 bytes in 0 blocks
==19608==      possibly lost: 0 bytes in 0 blocks
==19608==    still reachable: 326,164 bytes in 2,861 blocks
==19608==         suppressed: 56 bytes in 2 blocks
==19608== Reachable blocks (those to which a pointer was found) are not shown.
==19608== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==19608== 
==19608== For lists of detected and suppressed errors, rerun with: -s
==19608== ERROR SUMMARY: 284 errors from 49 contexts (suppressed: 0 from 0)
这是什么意思


编辑(回答):

以前有人问过类似的问题,请参阅此链接。是的,根据输出的消息判断,您的程序中存在内存泄漏。

valgrind没有显示泄漏位置的任何信息,我正在做
valgrind--tool=memcheck--leak check=full--show leak kinds=all--track origins=yes./bin
显示泄漏位置的标志是什么?@CheeseMan69您是否读取了输出
==19608==可访问块(找到指针的块)未显示==19608==要查看它们,请重新运行:--leak check=full--show leak kinds=all
您尝试过这个吗?@john我已经在做了,输出与post@CheeseMan69我建议你用你的最新输出编辑上面的问题,并明确您用于运行valgrind的标志以及用于编译代码的(relavent)标志。此可访问块不应是问题:。然而,错误摘要显示您有284个错误,我将查看这些错误。