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 39 40 41 42
|
[root@localhost sase]# valgrind --leak-check=full --show-leak-kinds=all ./a.out
==10190== Memcheck, a memory error detector
==10190== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==10190== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==10190== Command: ./a.out
==10190==
==10190== Invalid write of size 1
==10190== at 0x400AD6: main (a.cpp:33)
==10190== Address 0x6117f91 is 0 bytes after a block of size 1 alloc'd
==10190== at 0x4C2AB9D: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10190== by 0x400A12: main (a.cpp:27)
==10190==
==10190==
==10190== HEAP SUMMARY:
==10190== in use at exit: 104,608 bytes in 6,430 blocks
==10190== total heap usage: 43,480 allocs, 37,050 frees, 165,900,941 bytes allocated
==10190==
==10190== 1,334 bytes in 1,334 blocks are definitely lost in loss record 1 of 3
==10190== at 0x4C2A9C7: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10190== by 0x40099B: main (a.cpp:23)
==10190==
==10190== 30,570 bytes in 5,095 blocks are definitely lost in loss record 2 of 3
==10190== at 0x4C2AB9D: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10190== by 0x400A12: main (a.cpp:27)
==10190==
==10190== 72,704 bytes in 1 blocks are still reachable in loss record 3 of 3
==10190== at 0x4C28C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10190== by 0x552F1EF: ??? (in /usr/lib64/libstdc++.so.6.0.21)
==10190== by 0x400F669: call_init.part.0 (dl-init.c:72)
==10190== by 0x400F77A: call_init (dl-init.c:30)
==10190== by 0x400F77A: _dl_init (dl-init.c:120)
==10190== by 0x4000CC9: ??? (in /usr/lib64/ld-2.21.so)
==10190==
==10190== LEAK SUMMARY:
==10190== definitely lost: 31,904 bytes in 6,429 blocks
==10190== indirectly lost: 0 bytes in 0 blocks
==10190== possibly lost: 0 bytes in 0 blocks
==10190== still reachable: 72,704 bytes in 1 blocks
==10190== suppressed: 0 bytes in 0 blocks
==10190==
==10190== For counts of detected and suppressed errors, rerun with: -v
==10190== ERROR SUMMARY: 30608 errors from 3 contexts (suppressed: 0 from 0)
|