Valgrind

Home page Models Systems Tools IT staff References

Installing Valgrind Using Valgrind

Valgrind is a tool for profiling a program. It has a number of sub-tools/options for performing specific types of program profiling, such as memory leaks, cache performance (Cachegrind, KCachegrind), etc. This is the Valgrind web site. It is a Unix only tool, but does run on Macs.

Installing Valgrind

Linux Install

There is a Ubuntu package for Valgrind. Even though it isn't necessarily the current version, we use it because the latest version of Valgrind (3.7 as of this writing) does not work with Ubuntu 10.04. This has something to do with the particular version of the glibc library on Ubuntu not being compatible with Valgrind 3.7. To install from the Ubuntu package do the followng:

To install valgrind from source download the tar file from the Source Code tab of the Valgrind main web pag. See section 2.9 of the online use manual and also the end of this page. We install from a tar.bz2 distribution, so follow those instructions.

Mac Install

Follow the instructions for a Linux install from source.

Using Valgrind

See the online Valgrind documentation for tutorial and reference information on running valgrind. In addition to the basic valgrind usage instruction the sections on the .valgrindrc file and suppression files are useful.

By default valgrind does memory leak testing. This is mostly what we use it for - debugging memory problems with models, such as out of bounds array references, dangling pointers, uninitialized pointers, etc. It can be especially helpful when diagnosing segmentation faults that are caused by bad memory references.