1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <cstdio>
int main() {
    printf("%d\n", 1234345);
    return 0;
}
/*
> valgrind --leak-check=full --show-reachable=yes ./test.out
==57730== Memcheck, a memory error detector
==57730== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==57730== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==57730== Command: ./test.out
==57730==
1234345
==57730==
==57730== HEAP SUMMARY:
==57730==     in use at exit: 4,096 bytes in 1 blocks
==57730==   total heap usage: 1 allocs, 0 frees, 4,096 bytes allocated
==57730==
==57730== 4,096 bytes in 1 blocks are still reachable in loss record 1 of 1
==57730==    at 0x34F68: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck-x86-freebsd.so)
==57730==    by 0x24E543: ??? (in /lib/libc.so.7)
==57730==    by 0x24E404: ??? (in /lib/libc.so.7)
==57730==    by 0x241EC3: ??? (in /lib/libc.so.7)
==57730==    by 0x243B20: vfprintf_l (in /lib/libc.so.7)
==57730==    by 0x243BDC: vfprintf (in /lib/libc.so.7)
==57730==    by 0x22BA02: printf (in /lib/libc.so.7)
==57730==    by 0x8048514: main (in /usr/home/kevinptt/cpp/test.out)
==57730==
==57730== LEAK SUMMARY:
==57730==    definitely lost: 0 bytes in 0 blocks
==57730==    indirectly lost: 0 bytes in 0 blocks
==57730==      possibly lost: 0 bytes in 0 blocks
==57730==    still reachable: 4,096 bytes in 1 blocks
==57730==         suppressed: 0 bytes in 0 blocks
==57730==
==57730== For counts of detected and suppressed errors, rerun with: -v
==57730== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
*/