[vtk-developers] memory leak detection in visual studio

John Biddiscombe biddisco at cscs.ch
Tue Feb 3 08:02:23 EST 2009


Many years ago, I used constructs like the following

#include <cstdlib>
#include <malloc.h>
#include <crtdbg.h>

#if !defined(DEBUG_NEW)
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif

plus a bunch of other #defines etc, to tell Visual Studio to track all 
new/delete, malloc/free calls and display memory leaks on termination of 
the application.

If memory serves me right, it used to cause problems with std library 
related files because remapping the new operator for them was more tricky.

since I'm getting memory leaks in xdmf (and possibly elsewhere) I 
thiough about putting something into the setget.h or systemincludes to 
activate leak tracking for my debugging purposes, but before I attempt 
to get it all working, can anyone tell me if there is any existing 
mechanism or method that is less painful. Or perhaps someone has already 
modified the relevant headers in their local copy.

Thanks

JB

-- 
John Biddiscombe,                            email:biddisco @ cscs.ch
http://www.cscs.ch/
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82





More information about the vtk-developers mailing list