内存泄露 Heap Corruption Dected

VS :  Error Message in Debug Mode :

Heap Corruption Dectected

After Normal block (#81) at 0x003f74c0 CRT detected that the application wrote to memory after end of heap buffer

which is not appeare in Release Mode ( it terminate itself sliently)

 

This is a typical memory leak:

 

Reason of my situation:

 

int total_lenth = 6;
char *pstr = new char[total_lenth];
strcpy(pstr , "abcdefg");//Reason: store more than it could contain 
delete pstr;//error happen here

 

必须 “一个字节不差”

 

posted @ 2012-03-15 21:17  邓维  阅读(861)  评论(0编辑  收藏  举报