Since some days, I have been facing a problem in Visual Studio 2008, related to my C++ software. If I set Visual Studio settings to "Release Win32" mode, it works fine.
But if I set it to "Debug Win32", it has crash problems when using delete. Compiling is alright, but, when running, the software crashes on 1st "delete" it meets.
Consider this snaphsot:
As you can see, when software arrives to "delete temp;" command execution, it crashes showing the message:
Debug Assertion Failed! Program... Expression _BLOCK_TYPE_IS_VALID(pHead->nBlockHouse)
What is the problem? How to solve it?
Why in "Release" mode it doesn't have any errors?
Thanx
You should only delete
what you new
and delete[]
what you new[]
. Nothing else. You're also trying to use a null pointer to call a function. What happens when you try to call a method of nothing? Well, it can't be anything good.