Valgrind is a framework offering programming tools for code profiling and memory debugging.

Some Valgrind tools that are nice to know:

Memcheck

http://valgrind.org/docs/manual/mc-manual.html Use this to locate memory usage problems.

valgrind -tool=memcheck myProgram

It warns about reading/writing memory after it has been freed, uninitialised variables, memory leaks, ...

Callgrind

http://valgrind.org/docs/manual/cl-manual.html

A tool for performance analysis of your code.

It records the call history among functions in a program.

valgrind -tool=callgrind myProgram

The generated output can e.g. be used to get a summanry of CPU cost of individual functions.

callgrind_annotate [options] callgrind.out.pid

To visualise the callgrind output, there's also a GUI you can use: kcachegrind http://baptiste-wicht.com/posts/2011/09/profile-c-application-with-callgrind-kcachegrind.html

ComputingValgrind (last edited 2015-02-20 22:50:27 by AnnikaVauth)