...

/

Dynamic Analysis With Valgrind: Memcheck

Dynamic Analysis With Valgrind: Memcheck

Let's learn about utilities that can understand program source code to perform dynamic analysis with Valgrind.

Unfortunately, not all bugs can be caught before a program is executed. What can we do to get an even better insight into our projects?

Valgrind is an instrumentation framework that allows building dynamic analysis utilities—that is, analysis performed during a program's runtime. It offers an extensive tool suite that allows all kinds of investigations and checks.

Valgrind tools

Some of the tools provided by Valgrind are as follows:

  • Memcheck: Detects memory-management problems

  • Cachegrind: Profiles CPU caches, and pinpoints cache misses and other cache issues

  • Callgrind: An extension of Cachegrind with extra information on call graphs

  • Massif: A heap profiler that shows which parts of the program use heap over time

  • Helgrind: A thread debugger, which helps with data race issues

  • DRD: A lighter, limited version of Helgrind

Every single tool from this list is extremely handy when the occasion is right. Most package managers know Valgrind and can ...