K
Size: a a a
K
SK
СС
K
SK
SK
F
EP
F
K
K
SK
#include <stdlib.h>
int main(void){
int *a = (int *)malloc(1000);
a[1] = 0;
return 0;
}
g++ -g mtest.cpp
$ valgrind --leak-check=full --time-stamp=yes --track-origins=yes --vgdb=no ./a.out
==00:00:00:00.000 5204== Memcheck, a memory error detector
==00:00:00:00.000 5204== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==00:00:00:00.000 5204== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==00:00:00:00.000 5204== Command: ./a.out
==00:00:00:00.000 5204==
==00:00:00:00.953 5204==
==00:00:00:00.953 5204== HEAP SUMMARY:
==00:00:00:00.953 5204== in use at exit: 1,000 bytes in 1 blocks
==00:00:00:00.953 5204== total heap usage: 1 allocs, 0 frees, 1,000 bytes allocated
==00:00:00:00.953 5204==
==00:00:00:00.953 5204== 1,000 bytes in 1 blocks are definitely lost in loss record 1 of 1
==00:00:00:00.953 5204== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:00:00.953 5204== by 0x10915E: main (mtest.cpp:4)
==00:00:00:00.953 5204==
==00:00:00:00.953 5204== LEAK SUMMARY:
==00:00:00:00.953 5204== definitely lost: 1,000 bytes in 1 blocks
==00:00:00:00.953 5204== indirectly lost: 0 bytes in 0 blocks
==00:00:00:00.953 5204== possibly lost: 0 bytes in 0 blocks
==00:00:00:00.953 5204== still reachable: 0 bytes in 0 blocks
==00:00:00:00.953 5204== suppressed: 0 bytes in 0 blocks
==00:00:00:00.953 5204==
==00:00:00:00.953 5204== For lists of detected and suppressed errors, rerun with: -s
==00:00:00:00.953 5204== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
K
SK
K
NK
AP
СС
AP
AP