解决 after Normal block(#908) at 0x399EC0. CRT detected that the application wrote to memory after end of heap buffer 内存出错
1. 数组越界所导致
char* pBuffer = new char[2];
int v = 123;
strcpy(pBuffer, &v);
delete[] pBuffer;
2. 释放过的内存没有置为0,也就是就是野指针的问题
if (this->mstr != NULL)
{
delete[] this->mstr;
}
this->mstr = NULL;//必要
3.初学者在申请内存的时候”大意了“
char* pBuffer = new char[strlen(this->p)+1];
却写成了
char* pBuffer = new char(strlen(this->p)+1);
同样会在 析构delete[]的时候出现 内存中断。