CAsset_listNode::~CAsset_listNode()
{
if(Asset_Asset!=NULL)
{
delete Asset_Asset; // << HERE
Asset_Asset = NULL;
}
}
Annoying Debug error VS6 [BLOCKTYPE_IS_VALIID]
Annoying Debug error VS6
I have a pointer to an object created with new, in the class destructor I’m getting the following debug error when I hit the delete operator.
Debug Assertion Failed!
Dbgdel.cpp, line 47:
Expression : BLOCKTYPE_IS_VALIID(pHead->nBlockUse)
Does any one have some quick tips? Before I post pages of code.
Thanks
[Edited by - bobason456 on August 15, 2005 3:16:28 AM]
Either:
- you have deleted an object twice, or
- Asset_Asset is not a valid pointer, or
- Asset_Asset was not allocated with new, or
- you have written data past the end of an allocation and have overwritten the allocator's bookkeeping information.
Thanks.. I've found the problem, but not solved it. It was a problem with just one of the many classes that was being pointed to by Asset_Asset.. Unfortunately I was using that class to test my asset management code.
Thanks for your help though..
Just out of interest though, incase it is the issue. What is “you have written data past the end of an allocation and have overwritten the allocator's bookkeeping information.”?
Thanks for your help though..
Just out of interest though, incase it is the issue. What is “you have written data past the end of an allocation and have overwritten the allocator's bookkeeping information.”?
Memory allocators usually work by keeping a small amount of information at the start (and maybe end) of each block, such as block length and pointer to the previous block. This means when you do delete or free() it knows the range of memory you're giving up, plus it can combine that block with neighbouring blocks if they are also free. Incidentally I highly recommend Valgrind for catching this kind of error. Sadly it's only available for Linux though.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement