How to debug a “debug assertion failure” in VC++ 6
-
05-09-2019 - |
Question
I wonder how to debug the following error:
Debug Assertion failure
Program: tomtoprog.exe
File: dbgheap.c
Line: 1044
Expression:_CrtIsValidHeapPointer(pUserData)
...
I'm quiet new to windows development with VC++ 6 ... is there a valgrind or something like that? The tomtoprog code is not written by me and its rather messy ... so something like valgrind would make my life way easier ...
Thanks in advance!
Best regards,
Zhengtonic
Solution
It looks like you either have heap corruption or you are doing a double free of the same pointer. If you break into the debugger what is the last line of your code that is being called when the assert occurs?
The best way to check for issues like this is to use a page heap verifier like PageHeap.exe
Also see this related question on stack overflow
OTHER TIPS
Hit 'Retry', and it'll break into the debugger. That'll give you the call stack. From there, you can find the part of your code that's at fault.
Hint: you're probably delete/free-ing something twice.