Valgrind有选择

时间:2014-03-19 09:18:17

标签: c linux valgrind

如果我运行valgrind

valgrind --show-reachable=yes /home/costa/Desktop/zadacha_2_7/main.c

它说我仍然可以访问,所以我知道这意味着有一些内存,并没有被释放。

以下是valgrind的输出:

==2841== Memcheck, a memory error detector
==2841== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2841== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2841== Command: /home/costa/Desktop/zadacha_2_7/main.c
==2841== /home/costa/Desktop/zadacha_2_7/main.c: 5: 
         /home/costa/Desktop/zadacha_2_7/main.c: Syntax error: "(" unexpected
==2841== 
==2841== HEAP SUMMARY:
==2841==     in use at exit: 1,084 bytes in 68 blocks
==2841==   total heap usage: 70 allocs, 2 frees, 2,100 bytes allocated
==2841== 
==2841== LEAK SUMMARY:
==2841==    definitely lost: 0 bytes in 0 blocks
==2841==    indirectly lost: 0 bytes in 0 blocks
==2841==      possibly lost: 0 bytes in 0 blocks
==2841==    still reachable: 1,084 bytes in 68 blocks
==2841==         suppressed: 0 bytes in 0 blocks
==2841== Rerun with --leak-check=full to see details of leaked memory
==2841== 
==2841== For counts of detected and suppressed errors, rerun with: -v
==2841== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

所以,我希望看到这些可到达的块(未显示),我该怎么做?

我无法理解,为什么valgrind --show-reachable=yes没有显示有关这些块的任何内容?

1 个答案:

答案 0 :(得分:1)

你在这里复制的valgrind的输出:

==2841== Rerun with --leak-check=full to see details of leaked memory