VALGRIND is a program that can check for illegal memory references, the
use of uninitialized variables, and memory leaks.

The simplest way to use VALGRIND on a program that is suspected of having
memory leaks is to compile with the "-g" option, and then issue the VALGRIND
command followed by the normal execution command:

      gcc -g myprog.c
      mv a.out myprog
      valgrind myprog

On a Macintosh, it is necessary to include a particular switch that
generates the necessary symbol tables in order that VALGRIND can report
line numbers.

      valgrind --dsymutil=yes myprog

Web Site:



On any ARC cluster, check the installation details
by typing "module spider valgrind".

VALGRIND requires that the appropriate modules be loaded before it can be run.
One version of the appropriate commands for use on NewRiver is:

module purge
module load intel/15.3
module load valgrind/3.12.0


The following batch file checks the file test01.c

#! /bin/bash
#PBS -l walltime=00:05:00
#PBS -l nodes=1:ppn=1
#PBS -W group_list=newriver
#PBS -q open_q
#PBS -j oe
module purge
module load intel/15.3
module load valgrind/3.12.0
gcc -c -g test01.c
gcc -o test1 test1.o
valgrind ./test1

A complete set of files to carry out a similar process are available in