Archived

This topic is now archived and is closed to further replies.

asaari

"Debug Assertion Failed"

Recommended Posts

If I compile my work-in-progress-game(VC++ 6.0), under debug mode I get this error, ///////////////////////// Debug Assertion Failed! Program: ...FILES\MICROSOFT VISUAL STUDIO\MY PROJECTS\GAME\DEBUG\GAME.EXE File: dbgdel.cpp Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)); ///////////////////////// and if I compile and run it in Release mode, crashes before it even starts! =( does anyone have any idea what this means? thanks in advance ps. I could upload the program if anyone wants to see

Share this post


Link to post
Share on other sites
Err, thats the error message you get when you try to free some memory in windows and you''ve overwritten the end of it, isn''t it?

In debug mode the memory manager allocates a little extra memory than you request, so that it can detect overruns. It does this by writing a known value into this extra memory (such as 0xABBA), and then when you do the free, it makes sure that these values haven''t been changed. But they have been in your program so it throws up an assert.

It doesn''t do this memory cheking in release mode, so instead of writing into the extra overrun buffer, you''re probably writing into a vital bit of memory.


Game production:
Good, quick, cheap: Choose two.

Share this post


Link to post
Share on other sites
yep thats right, although I don''t think ABBA is a value It is usually 0xcccc or 0xdddd in MSVC. RTFM Search for debug new (you might get stuff about MFC).

A better alternative is to use Paul Nettle''s memory manager - search for it in the Ask Midnight column archives on www.flipcode.com. It''ll give you pin point accuracy on your memory leaks/pointer screwups.

Good luck!

~~~
Cheers!
Brett Porter
PortaLib3D : A portable 3D game/demo libary for OpenGL

Share this post


Link to post
Share on other sites
In my experience this most often occurs when you delete memory, do not set the pointer to NULL and try to delete it again somewhere else.

Seeya
Krippy


Edited by - krippy2k on July 23, 2001 8:27:49 AM

Share this post


Link to post
Share on other sites