Return to Snippet

Revision: 9579
at October 1, 2009 17:39 by jimfred


Updated Code
// Using the debugger (without changing code) see: http://msdn.microsoft.com/en-us/library/w2fhc9a3%28VS.80%29.aspx

// Includes...
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>


// Set this debug flag
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );

// break on a particular allocation as indicated in visual studio as {145}.
_crtBreakAlloc = 145;

Revision: 9578
at November 12, 2008 16:23 by jimfred


Initial Code
// Includes...
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>


// Set this debug flag
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );

// break on a particular allocation as indicated in visual studio as {145}.
_crtBreakAlloc = 145;

Initial URL
http://msdn.microsoft.com/en-us/library/w2fhc9a3%28VS.80%29.aspx

Initial Description
The Visual Studio output window will display "Detected memory leaks!" with a memory allocation number, for example, {145}. See Memory Leak Detection Enabling.

Using the debugger (without changing code) see: http://msdn.microsoft.com/en-us/library/w2fhc9a3%28VS.80%29.aspx

Initial Title
Visual Studio debug tools to detect and debug memory leaks by setting a breakpoint on a particular memory allocation.

Initial Tags
c

Initial Language
C++