is a suite of code analysis and debugging tools for Linux:
Valgrind is an award-winning instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile your programs in detail. You can also use Valgrind to build new tools.
The Valgrind distribution currently includes six production-quality tools: a memory error detector, two thread error detectors, a cache and branch-prediction profiler, a call-graph generating cache profiler, and a heap profiler. It also includes one experimental tool, which detects out of bounds reads and writes of stack, global and heap arrays.
Valgrind version 3.4.0 was recently released, it adds a long list
of improvements. The
release notes explain the changes, which include:
- The Memcheck utility now reports the origin of uninitialized values.
- The Helgrind thread error detector's race detection algorithm has
been redesigned for better scalability.
- Major improvements have been made to the DRD thread debugging tool.
- A new experimental Ptrcheck tool has been added, it checks for
- The exp-Omega instantaneous leak-detecting tool has been deprecated.
- Support has been added for the latest Linux distributions and Gnu
now have support for frame-level wild cards.
- Support has been added for the amd64/SSSE3 and IBM Power6
- It is now possible to cross-compile Valgrind so that it runs on one
architecture while supporting another.
- The command-line arguments have been added and improved.
- The code has been cleaned up and numerous bugs have been fixed.
- The documentation has been improved and updated.
- Version 1.4.0 of the Valkyrie GUI for Memcheck is coming soon.
installing the Valgrind 3.4.0 source code on an Ubuntu 8.10 system
was straightforward. For those who don't need the latest release,
version 3.3.1 is available as a standard Ubuntu package.
The source code was
uncompressed and extracted with tar. The standard Unix configure,
make and make install steps were run, the code built and installed
with no problems.
A test run of Valgrind was done on a fairly simple interactive C program.
Quick Start Guide was consulted, the program was compiled with
the -g flag and valgrind was run:
valgrind --leak-check=yes ./program options
This produced a report with a list of some still reachable
memory and a hint of how to get more information on the problem.
Following the hint, Valgrind was run again with:
valgrind --leak-check=full --show-reachable=yes ./program options
and the location of the code that produced the still reachable
memory was revealed.
This experiment only showed the most basic of Valgrind's utility in
debugging the simplest of test cases. Even so, it quickly revealed a
small memory leak in the tested code. The lengthy online
user manual explains the depth of Valgrind's testing capabilities
in full. Those who maintain large projects could likely improve their
code by running Valgrind and correcting any issues that it finds.
to post comments)