VALGRIND
1
Release &rel-version;

# valgrind

a suite of tools for debugging and profiling programs

      valgrind

        valgrind
        options

      your-program

        your-program-options

## Description

`Valgrind` is a flexible program for debugging and profiling Linux executables. It consists of a core, which provides a synthetic CPU in software, and a series of "tools", each of which is a debugging or profiling tool. The architecture is modular, so that new tools can be created easily and without disturbing the existing structure.

This manual page covers only basic usage and options. For more comprehensive information, please see the HTML documentation on your system: `&vg-doc-path;`, or online: `&vg-bookset;`.

## Invocation

`Valgrind` is typically invoked as follows:

        valgrind program args

This runs `program` (with arguments `args`) under Valgrind using the Memcheck tool. Memcheck performs a range of memory-checking functions, including detecting accesses to uninitialised memory, misuse of allocated memory (double frees, access after free, etc.) and detecting memory leaks.

To use a different tool, use the `--tool` option:

        valgrind --tool=toolname program args

The following tools are available:

- `cachegrind` is a cache simulator. It can be used to annotate every line of your program with the number of instructions executed and cache misses incurred.

- `callgrind` adds call graph tracing to cachegrind. It can be used to get call counts and inclusive cost for each call happening in your program. In addition to cachegrind, callgrind can annotate threads separately, and every instruction of disassembler output of your program with the number of instructions executed and cache misses incurred.

- `helgrind` spots potential race conditions in your program.

- `lackey` is a sample tool that can be used as a template for generating your own tools. After the program terminates, it prints out some basic statistics about the program execution.

- `massif` is a heap profiler. It measures how much heap memory your program uses.

- `memcheck` is a fine-grained memory checker.

- `none` performs no function - it simply runs the program under Valgrind. This is typically used for debugging and benchmarking Valgrind.

## Basic Options

## Error-Related Options

## malloc()-related Options

## Uncommon Options

## Debugging Valgrind Options

## Memcheck Options

## Cachegrind Options

## Callgrind Options

## Massif Options

## Helgrind Options

## Ptrcheck Options

## Lackey Options

## See Also

`&vg-doc-path;`, and/or `&vg-bookset;`.

## Author

This manpage has been written by Andres Roldan <aroldan@debian.org> for the Debian Project, but can be used for any other distribution.

Updated, rearranged and expanded by Robert Walsh <rjwalsh@durables.org> for the 2.4.0 release, and by other Valgrind developers subsequently.