ITK/Dynamic Analysis Practices

From KitwarePublic
Jump to navigationJump to search

Overview

  • ITK has a policy of ZERO Valgrind errors.
  • The developers community has put a lot of effort in reaching this level of quality and it is up to all contributors to keep the dynamic errors to the zero level.

How to run Valgrind locally

 How to use this script:

Step 1

Use Linux or Mac, install

  • valgrind
  • xsltproc

Step 2

Compile ITK with RelWithDebInfo CMAKE_BUILD_TYPE

Step 3

cd into the ITK binary build directory

Step 4

From the TOP of the binary directory type the "ctest" expression that selects the tests that you want to perform memory checking on.

For example:

   ctest  -R   itkHDF5ImageIOTest  -N

This will print the tests selected by the regular expression but not run the tests (-N option).

Step 5

Type the path to this script in the ITK source tree and add the select expression from step 4 above.

For example:

  ~/src/ITK/Utilities/Maintenance/runValgrind.sh          -R itkHDF5ImageIOTest

This will run the selected tests under valgrind and generate HTML that can be opened with your favorite browser. The HTML is written to ./memcheck_index.html To open:

In Linux, you can do

     firefox  ./memcheck_index.html

In Mac, you can do

     open     ./memcheck_index.html