How to use valgrind

Under:
  1. Check you run in debug mode
    % echo $NODEBUG
    should give:
    NODEBUG: Undefined variable.
    If not do
    % unsetenv NODEBUG
    % stardev

     

  2. Compile your code using cons
    ex: % cons +Hbt

     

  3. Run valgrind by default. There are 2 cases
    1. Version valgrind-20030725 on RedHat 7.2
      % valgrind `which root4star` -b -q 'macros.C()'
    2. Version valgrind-2.1.1 on RedHat 8.0 greater
      % valgrind --tool=memcheck `which root4star` -b -q 'macros.C()'
    We do not intend to upgrade the infrastructure on Redhat 7.2.
  4. You can add some options, for example
    • To redirect outputs in a file:  --log-file=Valgrind.log
    • To check memory leaks   :  --leak-check=yes
  5. For more options please look at this page