Installing and Testing Valgrind on Linux
Valgrind is an instrumentation framework for building dynamic analysis tools. Which is a fancy way of saying that it's a debugging suite that automatically detects many memory management and threading bugs, which is a very good thing. Valgrind can handle dynamically generated code, so long as none of the generated code is later overwritten by other generated code. It can also perform detailed profiling to help speed up your programs. It comes with extensive documentation.
BTW, it's pronounced with a short 'i', named after the Nordic entrance hall to Valhalla. "Grin", as in smile, rather than "grind" as in what one does with coffee.
Installation and testing is very simple. Download the source from the site, extract in the usual place, run configure, make, and make install.
tar xvjf valgrind-3.6.0.tar.bz2
The ../config file consists of;
./configure --prefix=/usr/local/$(basename $(pwd) | sed 's#-#/#')
Set the environment variables the usual way.
ln -s .base 3.6.0
If you don't have environment modules installed you should add the following to your appropriate path.
A short testing is achieved by running a usual program with a specified tool. Login a a normal user, load the environment variables and run the check.
module load valgrind/3.6.0
valgrind --tool=memcheck ./twelve