Detecting C++ memory leaks in Visual Studio - again

I made a small post about detecting C++ memory leaks in Visual Studio in 2010. At the time that seemed to suffice, but some months ago someone told me about Visual Leak Detector and boy does it work. According to the website itself Visual Leak Detector is a free, robust, open-source memory leak detection system for Visual C++. It’s pretty easy to use. After installing it, you just need to tell Visual C++ where to find the included header and library file. ...

June 3, 2012 · 1 min · 154 words · David Amador

Tracking memory leaks in Visual Studio

I just discovered this useful piece of code for all who don’t have (including me) any memory leaks tracking code or software. I know there are other and better solution but this can be handy for quick findings without much hassle. First place this code in your entry point file, generally main.cpp inside your main() function #ifdef _DEBUG int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); flag |= _CRTDBG_LEAK_CHECK_DF; // Turn on leak-checking bit _CrtSetDbgFlag(flag); #endif Now just run you game/program as you would normally, in debug mode of course. ...

October 19, 2010 · 1 min · 165 words · David Amador