[Insight-users] Image reader problem

Charles Knox knoxcharles at qwest.net
Tue May 13 15:51:07 EDT 2008


Hello Bill and Luis,

I'm still dealing with this DICOM image reader problem using ITK 3.6 and 
the new MSVC++ compiler, version 9.  The test program I've written 
(DICOMReaderTest) crashes, as I've described previously, when built in 
debug configuration.

However, the same program built as a release version works fine!  It 
reads DICOM, TIFF, ... properly.

Could it be the way memory is managed in MSVC v9.0 when in debug mode?  
I don't have the old MSVC compiler on this machine for comparison, but 
it doesn't appear that diagnostic memory management routines have 
changed, at least in how they are defined in one's application and the 
AFX macros.

The wizard still inserts a conditional #define statement near the top  
of each .cpp file:

...
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
...

DEBUG_NEW gets defined in AFX.H as :
/////////////////////////////////////////////////////////////////////////////
// Diagnostic memory management routines (AFX.H)

// Low level sanity checks for memory blocks
BOOL AFXAPI AfxIsValidAddress(const void* lp,
            UINT_PTR nBytes, BOOL bReadWrite = TRUE);
BOOL AFXAPI AfxIsValidString(LPCWSTR lpsz, int nLength = -1);
BOOL AFXAPI AfxIsValidString(LPCSTR lpsz, int nLength = -1);

// Sanity checks for ATOMs
BOOL AfxIsValidAtom(ATOM nAtom);
BOOL AfxIsValidAtom(LPCTSTR psz);

#if defined(_DEBUG) && !defined(_AFX_NO_DEBUG_CRT)

// Memory tracking allocation
void* AFX_CDECL operator new(size_t nSize, LPCSTR lpszFileName, int nLine);
#define DEBUG_NEW new(THIS_FILE, __LINE__)
#if _MSC_VER >= 1200
void AFX_CDECL operator delete(void* p, LPCSTR lpszFileName, int nLine);
#endif

void * __cdecl operator new[](size_t);
#if _MSC_VER >= 1210
void* __cdecl operator new[](size_t nSize, LPCSTR lpszFileName, int nLine);
void __cdecl operator delete[](void* p, LPCSTR lpszFileName, int nLine);
void __cdecl operator delete[](void *);
#endif

/////////////////////////////////////////////////////////////////////////////

I also see that no changes have occurred in itkLightObject.h or .cxx 
between ITK 3.4 and 3.6, the only places where the new and delete 
operators are redefined for the itk namespace (at least in the functions 
I'm using).

So... I'm still stumped.

Charlie




More information about the Insight-users mailing list