Jump to content
  • Advertisement
Sign in to follow this  
The C modest god

Debug assertion failed

This topic is 5409 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have got a debug assertion failed error while runnig my program. It said there was an error in line 1044 in the file dbgheap.c. I looked in that file and found this:
        /*
         * If this ASSERT fails, a bad pointer has been passed in. It may be
         * totally bogus, or it may have been allocated from another heap.
         * The pointer MUST come from the 'local' heap.
         */
        _ASSERTE(_CrtIsValidHeapPointer(pUserData));
The problem is that I cant cause this error to happen, it just happens once in a while. What in my program may cause this error? What am I doing wrong?

Share this post


Link to post
Share on other sites
Advertisement
You are either trying to delete a block of memory you never allocated, or are mismatching array/scalar new and delete, or you have written past the end of some array, trashing the compiler's memory allocation bookkeeping header for the array that followed.

Share this post


Link to post
Share on other sites
You're deleting an invalid pointer somewhere. Use the call stack to see what function of yours is calling delete. If you post the value of the pointer being deleted, we can see if its any 'well known' values (e.g. 0xcdcdcdcd is uninitialized memory).
Or, you could be allocating memory in a DLL and freeing it in the EXE, or vice versa.

EDIT: Damn, beaten to it [wink]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!