Sunday, February 23, 2014

Valgrind - Overview


Recently, I explored Valgrind's capabilities. In this post, I will provide a high level overview of this tool.


Valgrind is a GPLv2 tool that can be used to find functional and performance issues in linux user space C/C++ applications. It is architected as an extendable/modular framework to which a custom sub-tool can be hooked without touching core part of Valgrind. In this modular framework, Valgrind offers each of it's standard capabilities as sub-tools. Valgrind today has 6 production quality sub-tools & 3 experimental sub-tools.


The standard sub-tools help to:

  • detect run-time memory errors - leaks, corruptions, buffer over tuns etc (memcheck)
  • detect locking issues in multi-thread programming (helgrind, DRD)
  • debug performance issues
    • Instruction & Data (L1/L2) cache hits/misses at per-function, per-module whole program level & also detail the code which is causing the misses (cachegrind, callgrind)
    • code profiling (use callgrind & then feed output of callgrind to visualization tool Kcachegrind)
    • detect memory hogs using memory snapshot profiling (massif)

The experimental sub-tools help to:

  • detect stack and global array corruptions using behavioral heuristics (SGCheck)
  • heap usage statistics that help optimize improve data structure field grouping, reduce unnecessary allocations, etc.. (DHAT)
  • cpu cycle level profiler that helps in architecture research (BBV)

Among these use cases, Valgrind is popular for detecting run time memory errors (memcheck sub-tool). So, I will cover Valgrind's memcheck sub-tool in my next posts - Valgrind's Memcheck: Detect user space run time memory errorsValgrind's Memcheck + Valkyrie: Detect user space run time memory errors.


Reference:

http://valgrind.org/

No comments:

UA-48797665-1