Product SiteDocumentation Site

6.2.2. Using Valgrind

The valgrind package and its dependencies install all the necessary tools for performing a Valgrind profile run. To profile a program with Valgrind, use:
valgrind --tool=toolname program
Refer to Section 6.2.1, “Valgrind Tools” for a list of arguments for toolname. In addition to the suite of Valgrind tools, none is also a valid argument for toolname; this argument allows you to run a program under Valgrind without performing any profiling. This is useful for debugging or benchmarking Valgrind itself.
You can also instruct Valgrind to send all of its information to a specific file. To do so, use the option --log-file=filename. For example, to check the memory usage of the executable file hello and send profile information to output, use:
valgrind --tool=memcheck --log-file=output hello
Refer to Section 6.2.4, “Valgrind Documentation” for more information on Valgrind, along with other available documentation on the Valgrind suite of tools.