Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
software:valgrind [2008/11/18 14:45]
cyril created
software:valgrind [2013/09/19 16:40] (current)
Line 1: Line 1:
 ====== Valgrind ====== ====== Valgrind ======
-===== Cheat sheet =====+===== General options =====
  
 +Syntax: **''valgrind [options] <your-program> <args>''**
  
-  * **''valgrind <your-program> <args>''** : memory checker +  * **''--db-attach=yes''** : to automatically attach gdb on errors 
-  * **''valgrind --db-attach=yes <your-program> <args>''** : to automatically attach gdb on errors +  * **''--error-limit=no''** : to display all errors even if there are a lot of them 
-  * **''valgrind --leak-check=full <program> <args>''** : to completely analyse memory leaks +  * **''--num-callers=50''** : to increase the maximum backtrace displayed 
-  * **''valgrind --tool=massif --time-unit=<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 +===== Tools ===== 
-  **''valgrind --tool=cachegrind <program-compiled-O2> <args>''** : CPU cache profiling in order to find cache misses+==== Memcheck ==== 
 +Memory checker (default tool). 
 + 
 +Syntax: **''valgrind [--tool=memcheck] [options] <your-program> <args>''** 
 + 
 +  * **''--leak-check=full''** : to completely analyse memory leaks 
 +  * **''--show-reachable=yes''**: to show the detail of reachable memory 
 +  * **''--track-origins=yes''** : to display where was allocated the "uninitialized value" 
 + 
 + 
 +==== Massif ==== 
 +Memory profiling. 
 + 
 +Syntax: **''valgrind --tool=massif [options] <your-program> <args> ms_print massif.<pid>''** 
 + 
 +  * **''--time-unit=B''** : display results in bytes 
 + 
 +==== Callgrind ==== 
 +Performance profiling, to find time taken in functions and number of calls of functions. 
 + 
 +Syntax: **''valgrind --tool=callgrind <program-compiled-O2> <args> kcachegrind callgrind.out.xxxx calgrind_control''** 
 + 
 +==== Cachegrind ==== 
 +CPU cache profiling, to find cache misses. 
 + 
 +Syntax: **''valgrind --tool=cachegrind <program-compiled-O2> <args>''**
  
 Always do profiling with optimization options of compiler, or you could optimize things that the compiler already automatically does. 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