PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

strange asserte on delete of pointer

Hi,

I allocate and deallocate a buffer using the following code:

Code:
pReadBuffer = new char [dwAvailable + 1];

// do some stuff

if (pReadBuffer)
{
delete [] pReadBuffer;
pReadBuffer = NULL;
}


On the delele [] line. The win32 app asserts on the following line in dbgheap.c

Code:
/* Error if freeing incorrect memory type */
_ASSERTE(pHead->nBlockUse == nBlockUse);


Googling for it showed that this can caused by mixing single and multithreaded libraries. I tried a lot of variations, but still no solution. How is the GapiDraw.dll build? Single or Multithreaded and then static or in a dll?

Maurice
The issue is probably caused by another error in your program. Try pasting the above code into the "minimal" sample and I guess it will work.. Memory errors are sometimes really nasty...