3.2.so)
==16541== by 0x8048284: (within valgrind_1)
==16541==
==16541== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
==16541== malloc/free: in use at exit: 0 bytes in 0 blocks.
==16541== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==16541== For a detailed leak analysis, rerun with: --leak-check=yes
==16541== For counts of detected errors, rerun with: -v
In the example output, the number 16541 in the left margin is the process ID (pid) of
the valgrind process. The first line of output explains that valgrind is making use of its
memcheck tool to perform its most complete analysis of memory use. Following the
copyright notice, you see the single error message that valgrind reports for the example
program. In this case, the variable p is being read before it has been initialized. Because
valgrind operates on compiled programs, it reports virtual memory addresses in its
error messages rather than referencing original source code line numbers. The ERROR
SUMMARY at the bottom is self-explanatory.
A second simple example demonstrates valgrind??™s heap-checking capabilities. The
source code for this example is as follows:
/*
* valgrind_2.c - access outside of allocated memory
*/
#include
Pages:
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623