MemoryLeakDetection
From MantidProject
Windows
Under windows do the following:
- Install Visual Leak Detector - This can be found [here]
- Setup the additional paths as defined in the readme file
- Adjust the configuration file to output to both File and debugger
- Add #include <vld.ini> to the system.h file in Kernel
- Compile everything in debug
- Running unit tests should now create a file memory_leak_report.txt in the test directory.
- 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].
