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
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s