# 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!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.dewaka.com/programming-languages/cpp/c++-tools/valgrind.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
