   Assertion failed! at delete[]
  Hello!I've got another problem. Sometimes, when I do this:void PckFileChunk::DeleteData(){    if(Data)    {  delete[] Data;  Data=NULL;    }}I get this:And I already checked if Data (Which is of the type Byte*) is invalid, and it is.(Or maybe not?)What causes this "assertion failed"?   
  (1) CrtIsValidHeapPointer checks if a pointer is referring to space in the local heap.(2) It is redundant and unnecessary to check "if(Data)" before invoking delete[]. delete[] on a null pointer is a safe no-op.   ;  So, what can I do?PS: 2. is cool, I didn't knew that! :)   ;  Debug your code.The pointer you are trying to delete isn't in the local heap. That means it has a bad value. This could be because of any number of reasons; you assigned it a value that you'd already deleted, you overwrite memory elsewhere, stomping on the object that contains the Data member such that it refers to an invalid address, et cetera.   ;  Stupid question, but did you accidentally make Data point to a stack object?   ;  I've fixed the problem now. Over some wired ways, I found out that I passed the data from a ID3D10Blob interface directly. And this interface deletes the memory when it gets released. Everything is fine now :)   