Valgrind tools automatically detect many memory management and threading bugs, and is able to profile your programs in detail. It runs on the following platforms: X86/Linux, AMD64/Linux, ARM/Linux, PPC32/Linux, PPC64/Linux, S390X/Linux, ARM/Android (2.3.x), X86/Darwin and AMD64/Darwin (Mac OS X 10.6 and 10.7)
According to Valgrind, a number of useful tools are supplied as standard.
- Memcheck is a memory error detector. It helps you make your programs, particularly those written in C and C++, more correct.
- Cachegrind is a cache and branch-prediction profiler. It helps you make your programs run faster.
- Callgrind is a call-graph generating cache profiler. It has some overlap with Cachegrind, but also gathers some information that Cachegrind does not.
- Helgrind is a thread error detector. It helps you make your multi-threaded programs more correct.
- DRD is also a thread error detector. It is similar to Helgrind but uses different analysis techniques and so may find different problems.
- Massif is a heap profiler. It helps you make your programs use less memory.
- DHAT is a different kind of heap profiler. It helps you understand issues of block lifetimes, block utilisation, and layout inefficiencies.
- SGcheck is an experimental tool that can detect overruns of stack and global arrays. Its functionality is complementary to that of Memcheck: SGcheck finds problems that Memcheck can’t, and vice versa..
- BBV is an experimental SimPoint basic block vector generator. It is useful to people doing computer architecture research and development.
Compilation of Valgrind
Compilation is very straightforward……
# tar -xvjpf valgrind-3.7.0.tar.bz2 # cd valgrind-3.7.0 # ./configure --prefix=/usr/local/valgrind-3.7.0 # make; make install
# /usr/local/valgrind-3.7.0/bin/valgrind ls -l
Either this works, or it bombs out with some complaint.