This is an old revision of the document!


Valgrind

Cheat sheet

  • valgrind <your-program> <args> : memory checker
  • valgrind –db-attach=yes <your-program> <args> : to automatically attach gdb on errors
  • valgrind –leak-check=full <program> <args> : to completely analyse memory leaks
  • valgrind –tool=massif –time-unit=B <program> <args> + ms_print massif.<pid> : statistics about which functions are using memory
  • valgrind –tool=callgrind <program-compiled-O2> <args> + kcachegrind callgrind.out.xxxx + calgrind_control : call profiling
  • valgrind –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.

software/valgrind.1227019514.txt.gz · Last modified: 2013/09/19 16:43 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0