MemoryLeakDetection

From MantidProject

Jump to: navigation, search

Windows

Under windows do the following:

  1. Install Visual Leak Detector - This can be found [here]
  2. Setup the additional paths as defined in the readme file
  3. Adjust the configuration file to output to both File and debugger
  4. Add #include <vld.ini> to the system.h file in Kernel
  5. Compile everything in debug
  6. Running unit tests should now create a file memory_leak_report.txt in the test directory.
  7. IMPORTANT remove the #include <vld.ini> before checking in.

Linux/Mac

You will need the Valgrind suite of tools installed on your system. Running a memory leak check is straightforward; you simply pass your executable as an argument to Valgrind, thus: valgrind [executable_name]. Note that it will take a lot longer than usual to run the executable, at the end of which it will produce a report (which may be long so you may want to redirect the output to a file).

This default option will give details of any memory issues such as use of uninitialised variables or mismatched new/new[] and delete/delete[], along with a summary of the total amount of memory leaked. To get a full breakdown of any memory leaks, run valgrind --leak-check=full [executable_name].

Personal tools
Create a book