This is an old revision of the document!
Valgrind
Cheat sheet
valgrind <your-program> <args>
: memory checkervalgrind –db-attach=yes <your-program> <args>
: to automatically attach gdb on errorsvalgrind –leak-check=full <program> <args>
: to completely analyse memory leaksvalgrind –tool=massif –time-unit=B <program> <args>
+ms_print massif.<pid>
: statistics about which functions are using memoryvalgrind –tool=callgrind <program-compiled-O2> <args>
+kcachegrind callgrind.out.xxxx
+calgrind_control
: call profilingvalgrind –tool=cachegrind <program-compiled-O2> <args>
: CPU cache profiling in order to find cache misses
Always do profiling with optimization options of compiler, or you could optimize things that the compiler already automatically does.