如何使Valgrind准确显示错误发生的位置? 我使用-g调试选项编译了我的程序(通过PuTTy在Linux终端上的Windows机器上进行)。
运行Valgrind时,我得到了泄漏和堆摘要,我肯定丢失了内存,但我从未获得有关它发生在哪里的信息(文件名,行数)。 Valgrind不应该告诉我在分配内存后的哪一行失败了,无法稍后释放吗?
==15746==
==15746== HEAP SUMMARY:
==15746== in use at exit: 54 bytes in 6 blocks
==15746== total heap usage: 295 allocs, 289 frees, 11,029 bytes allocated
==15746==
==15746== LEAK SUMMARY:
==15746== definitely lost: 12 bytes in 3 blocks
==15746== indirectly lost: 42 bytes in 3 blocks
==15746== possibly lost: 0 bytes in 0 blocks
==15746== still reachable: 0 bytes in 0 blocks
==15746== suppressed: 0 bytes in 0 blocks
==15746== Rerun with --leak-check=full to see details of leaked memory
==15746==
==15746== For counts of detected and suppressed errors, rerun with: -v
==15746== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 15 from 8)