I recently upgraded to vs2012 and am making liberal use of its leak detection described here:
http://msdn.microsoft.com/en-us/library/x98tx3cf.aspx
However, I'm running into a spot of trouble. I rely on the C++ style new commands to allocate memory and as such, I make use of redefining this call in order to get a specific file and line, at the end of my programs execution, to where I allocated memory which is leaking. It's super effective!
According to the link above, the new command is to be redefined thusly:
#ifdef _DEBUG #ifndef DBG_NEW #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) #define new DBG_NEW #endif #endif // _DEBUG
Which will break quite a bit of perfectly conforming C++ code :-( I use Visual Leak Detector: http://vld.codeplex.com/ which offers much better error reporting than MSVC's built in stuff and is still free. HTH, John.