Valgrind is a set of tools to identify problems with memory, detecting memory leaks and profiling.

Was created by Valgrind as a tool for debugging memory usage on GNU / Linux systems architecture x86, but later the project developed a generic framework for creating dynamic analysis tools memory usage profiling (capturing the characteristics of the applications) and error detection associated with synchronization in multithreaded applications.

Valgrind has a modular architecture that performs CPU emulation kernel modules and analyzers performing the collection and analysis of information obtained during the execution of the code on the emulator.

The basic module Valgrind is memcheck, it allows the detection of memory leaks and other errors due to incorrect work with memory. Module cachegring analyzes the execution of code, collecting data (statistics) the entire application, individual functions and lines of code.

Module callgring analyzes the function calls that allows you to build a tree of calling functions and, accordingly, to analyse bottlenecks in the application.

Module massif analyzes the allocation of different parts of the application, the module helgrig analyze executed code for different synchronization errors, when using multi-threaded code.

Valgrind is quite easy to use, necessary functions are set options from the command line, for the studied application no special preparation is required. The analyzed application is started with the specified arguments (if needed) and it will be a search for memory leaks.

By default, Valgrind runs the module memcheck, but the user can specify the module to execute. To facilitate use of frequently used options to set in the configuration file (~/valgrindrc) and they do not have to enter every run (some options are the same for all modules).

Error reading and writing beyond the allocated memory, plus several kinds of errors reported immediately, the process of the application. Mistakes leading to memory leaks appear after the completion of the analyzed application, in the form of a matrix describing the number of errors, and memory allocation.

Detailed data is written to the file (massif.out.), for their analysis can be used built-in command line utility ms_printthat outputs data in the form of ASCII-graphics (or third-party applications, such as Massif Visualizer).

Valgrind is included in virtually all GNU / Linux systems and is well documented, there are a number of modules are considered experimental (not very stable), also the user can create modules analyzing executable code.

License: GNU General Public License version 2.0 (GPLv2)

Home page

Author: posixru


(Visited 44 times, 1 visits today)