1、test程序中会有打印信息,in papa 、in kid是test程序的打印信息。
2、两个等号中间的数字是valgrind执行时在系统中的进程号。
valgrind --tool=memcheck ./test
==12592== Memcheck, a memory error detector
==12592== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==12592== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==12592== Command: ./test
==12592==
in kid
in papa
==12592== Invalid write of size 4
==12592== at 0x10922B: k (test.c:10)
==12592== by 0x1092B7: main (test.c:24)
==12592== Address 0x4a494a4 is 4 bytes after a block of size 32 alloc'd
==12592== at 0x483C7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==12592== by 0x10921E: k (test.c:9)
==12592== by 0x1092B7: main (test.c:24)
==12592==
==12593==
==12593== HEAP SUMMARY:
==12593== in use at exit: 0 bytes in 0 blocks
==12593== total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated
==12593==
==12593== All heap blocks were freed -- no leaks are possible
==12593==
==12593== For lists of detected and suppressed errors, rerun with: -s
==12593== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)