[Insight-users] Memory Leak in very simple ITK/MFC Code
Frank Miller
frankmiller at jhu.edu
Mon Sep 26 17:33:54 EDT 2005
Greetings,
Im getting strange memory leaks every time I use ITK with MFC. Here is
how I can reproduce the problem. (Warning: I dont use CMake. Please
dont flame me. I understand that CMake is great.)
First Case ( just to prove I know what Im doing ):
I create a new Win32 Console Project in Visual Studio (.Net 2003). I
add the Hello World code from the ITK Software Guide into the program.
If it has been a while since you have read the Guide, here is the code.
#include "itkImage.h"
// ...
typedef itk::Image< unsigned short, 3 > ImageType;
ImageType::Pointer image = ImageType::New();
// ...
I link to the appropriate libraries, build, run, and everything works great.
Second Case:
I create a new MFC SDI Application. I add the exact same Hello World
code, and link and build just as before. Except, when I run the program
this time, I leak about 12 bytes of memory.
Detected memory leaks!
Dumping objects ->
{159} normal block at 0x010E9D60, 12 bytes long.
Data: <` ` > 60 9D 0E 01 60 9D 0E 01 CD CD CD CD
{158} normal block at 0x010E9D18, 12 bytes long.
Data: < ` > CD CD CD CD 60 9D 0E 01 00 00 00 00
Object dump complete.
When I do more complicated things, I leak more memory. But it always
works great in a Win32 Console Project. My intuition tells me that it
has something to do with Debug mode but I am not smart enough to detect
a memory leak in a Release mode.
I would greatly appreciate any help,
Frank
More information about the Insight-users
mailing list