Valgrind is a collection of open source C/C++ debugging and profiling tools for the Unix and Linux platforms. The collection of tools that Valgrind supports are as follows:
- Cachegrind: This is the cache profiler
- Callgrind: This works in a similar manner to the cache profiler but supports the caller-callee sequence
- Helgrind: This helps in detecting thread synchronization issues
- DRD: This is the thread error detector
- Massif: This is the heap profiler
- Lackey: This provides basic performance-related statistics and measurements about your application
- exp-sgcheck: This detects stack overruns; it is generally useful in finding issues that Memcheck can't find
- exp-bbv: This is useful for computer architecture R&D-related work
- exp-dhat: This is another heap profiler
- Memcheck: This helps in detecting memory leaks and crashes related to memory issues
In this chapter, we will only be exploring Memcheck, as demonstrating every Valgrind tool is not in the scope of this book.