Al
2003-10-17 10:01:44 UTC
I'm having problems tracking down memory leaks in my MFC
application. I'm following the instructions in MSDN
article "Detecting and Isolating Memory Leaks Using
Microsoft Visual C++" but I only ever get the basic
information when memory leaks are detected. It's as
if "#define _CRTDBG_MAP_ALLOC" is being ignored so I
don't get file and line number information.
I produced a noddy MFC SDI application to test this:
In LeakTest.h, I have
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
In CLeakTestApp::InitInstance(), I have
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF |
_CRTDBG_LEAK_CHECK_DF);
I also have a Leak menu item which allocates 5555 bytes.
So given that I have defined _CRTDBG_MAP_ALLOC, why does
the leak report say
Detected memory leaks!
Dumping objects ->
{88} normal block at 0x003250A0, 5555 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD
CD CD CD CD CD CD
Object dump complete.
instead of something like
Detected memory leaks!
Dumping objects ->
U:\MyProjects\leaktest\mainfrm.cpp(108) : {88} normal
block at 0x003250A0, 5555 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD
CD CD CD CD CD CD
Object dump complete.
--- Al.
application. I'm following the instructions in MSDN
article "Detecting and Isolating Memory Leaks Using
Microsoft Visual C++" but I only ever get the basic
information when memory leaks are detected. It's as
if "#define _CRTDBG_MAP_ALLOC" is being ignored so I
don't get file and line number information.
I produced a noddy MFC SDI application to test this:
In LeakTest.h, I have
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
In CLeakTestApp::InitInstance(), I have
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF |
_CRTDBG_LEAK_CHECK_DF);
I also have a Leak menu item which allocates 5555 bytes.
So given that I have defined _CRTDBG_MAP_ALLOC, why does
the leak report say
Detected memory leaks!
Dumping objects ->
{88} normal block at 0x003250A0, 5555 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD
CD CD CD CD CD CD
Object dump complete.
instead of something like
Detected memory leaks!
Dumping objects ->
U:\MyProjects\leaktest\mainfrm.cpp(108) : {88} normal
block at 0x003250A0, 5555 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD
CD CD CD CD CD CD
Object dump complete.
--- Al.