Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting rid of "Debug Assertion Failed"

Status
Not open for further replies.

gleason

Programmer
Jun 2, 1999
50
US
We have a large application built with Microsoft Visual C++ 6.0 that runs on a Win98 client. We do build "Win32 Debug" builds for internal testing / debugging but we always build "Win32 Release" versions before releasing applications to the field. Lately we have begun seeing the following message box pop up at some of our customer's sites:

Microsoft Visual C++ Debug Library
Debug Assertion Failed
Program C:\PROG\PROG.EXE
File dbgdel.cpp
Line 47
Expression: _BLOCK_TYPE_IS_VALID (pHead->nBlockUse)

Examining dbgdel.cpp (line 47) I see the following line:
_ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse));

When I look at the definition of the _ASSERTE macro, I see the following two definitions (in CRTDEBUG
#ifndef _DEBUG
#define _ASSERTE(expr) ((void)0)
[...snip..]
#else
#define _ASSERTE(expr) do { if (!(expr) && (1 == _CrtDbgReport(_CRT_ASSERT, __FILE__, __LINE__, NULL, #expr))) _CrtDbgBreak(); } while (0)

I examined my preprocessor definitions for the "Win32 Release" environment and made sure that there is not a preprocessor definition for _DEBUG when I do a release build. (There is one called "NDEBUG" for my release builds but not a _DEBUG.

Any help / opinions would be greatly appreciated as this one really has me scratching my head!

Thanks,

Pat Gleason

Pat Gleason
gleason@megsinet.net

 
Just wanted to update this post with my final results. The workspace had excluded the default library LIBCMT which apparently causes LIBCMTD to be used. Therefore, the delete operator was being resolved from LIBCMTD (actually from dbgdel.obj) instead of from LIBCMT (debug.obj).

My program still throws a runtime exception (because it was deleting a pointer that didn't get properly created), but it was easy to track down the error by catching the exception and get a fix in the code.

Pat Gleason
gleason@megsinet.net

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top