> For the complete documentation index, see [llms.txt](https://wiki.dewaka.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.dewaka.com/programming-languages/cpp/c++-tools/valgrind.md).

# Valgrind

Valgrind is super useful for debugging native programs. Valgrind can be used to uncover memory leaks, concurrency issues and a lot more.

## How valgrind works

* [The design and implementation of Valgrind](https://courses.cs.washington.edu/courses/cse326/05wi/valgrind-doc/mc_techdocs.html)

## Usage

* Checking for memory leaks of a program (`hello`),

  ```bash
  valgrind --leak-check=full ./hello
  ```

  If you see a message like, *All heap blocks were freed -- no leaks are possible*, then your program is probably leak free!
