Sign in to follow this  
CrazyCamel

How To Fix Debug Assertion Error?

Recommended Posts

CrazyCamel    122
I get the "Debug Assertion Failed!" notification when I run my program. When I run the debugger, it doesn't show where in my code the error line is. How, then, can I track down and fix this problem? EDIT:: Its in dbgdel.cpp line 52. Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)

Share this post


Link to post
Share on other sites
mossmoss    326
Without knowing more of the context, I can only guess at what the assertion means.

Offhand, I'd say you're trying to free a chunk of memory, but using the wrong delete to do it.

If you alloc with new, dealloc with delete.
If you allow with new[ ], dealloc with delete[ ].

My guess is that this assertion is to check that you used the correct pairing.

Share this post


Link to post
Share on other sites
CrazyCamel    122
Ah, thank you. Turns out one of my functions was taking in a pointer to an int, and I was trying to check if the integer itself was 0, but instead, I was checking if the pointer was 0. That caused a chain of problems, including the screw up of a char* array. I was able to fix it though, thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this