Windows has triggered a breakpoint in t.exe.
This may be due to a corruption of the heap, which indicates a bug in t.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while t.exe has focus.
The output window may have more diagnostic information.
这个错误发生的两个原因:
1.用delete或是free删除不是堆栈上的变量。
比如:
int n = 88;
delete n;
2.使用了已经delete或是free后的变量。
比如:
char *str = (char *) malloc(100); strcpy(str, "hello"); free(str); if(str != NULL) { strcpy(str, "world"); printf(str); }

本文探讨了导致heap corruption的两种常见情况:一是误用delete或free操作来释放非堆分配的变量;二是对已释放的内存进行操作。文章通过具体代码示例详细解释了这两种情形,并提供了调试此类问题的方法。
7703

被折叠的 条评论
为什么被折叠?



