Monday, November 21, 2011

Brief overview of Valgrind usage

This write-up covers some very basis commands. But I will try to list out some of the other collections of tutorial and reading to complement this lack of information. I'm assuming that you have compiled the program as written in Compiling Valgrind on CentOS 5 One of the most commonly used command in Valgrind is
# valgrind --tool=memcheck --leak-check=full ./my_program
Commonly-used Options
S/No Command Option Description
1 --leak-check=<no|summary|yes|full> [default: summary] When enabled, search for memory leaks when the client program finishes. If set to summary, it says how many leaks occurred. If set to full or yes, it also gives details of each individual leak.
2 --show-reachable=<yes|no> [default: no] When disabled, the memory leak detector only shows "definitely lost" and "possibly lost" blocks. When enabled, the leak detector also shows "reachable" and "indirectly lost" blocks. (In other words, it shows all blocks, except suppressed ones)
For more information on more details usage of Valgrind of options and how to use,
  1. Valgrind Manual - 4.3 Memcheck Command Options
  2. Using Valgrind to Find Memory Leaks and Invalid Memory Use
  3. Using Valgrind to debug memory leaks

No comments: