CSCI 5828 - Presentation 3
$ valgrind [valgrind-options] <your prog here> [prog options]
or
$ valgrind --tool=memcheck [valgrind-options] <your prog here> [prog options]
--track-origins=yes # track origins of uninitialized values; will not do this by default
--leak-check=yes # Enables detailed leak detector. Recommendation: run first without this option,
# it can be verbose. leak-check can be set to any of {no, summary, yes, full}
-v # Verbose. Get more information.
--trace-children=yes # follow child processes (for example, exec* family of functions)
--child-silent-after-fork=yes # suppress output from a forked process
--tracking fds=yes # track open file descriptors
$ valgrind --tool=helgrind
--ignore-thread-creation= [default: no]
--check-stack-refs=no|yes [default: yes]
--free-is-write=no|yes [default: no]
--track-lockorders=no|yes [default: yes]
--show-stack-usage= [default: no]
--show-confl-seg= [default: yes]
--shared-threshold= [default: off]
--check-stack-var= [default: no]
valgrind --tool=cachegrind prog
cachegrind.out.<pid>
each time the program is runeiriano> cg_annotate cachegrind.out.8561
valgrind --tool=cachegrind prog
cg_annotate cachegrind.out.pid
This preamble is a summary of configuration options. Is your configuration correct?
cg_annotate cachegrind.out.pid
Next we see a summary of running the entire program
cg_annotate cachegrind.out.pid
And last is a summary of each function call
valgrind --tool=callgrind [callgrind options] your-program [program options]
callgrind_control -b
callgrind_control -e -b
callgrind_annotate [options] callgrind.out.<pid>
valgrind --tool=massif
To see the information gathered by Massif in an easy to read form, use ms_print <filename>
valgrind --tool=massif --time-unit=B ./myGreatProg