malloc和new的隐藏错误:CRT detected that the application wrote to memory after end of heap buffer
资料引用
原因
C++中的delete函数或者C的free函数越界,释放了过多空间
例子
RecType* R1 = (RecType*)malloc((sizeof(RecType)*(high - low))); //Rectype来自typedef
free(R1);
动态分配空间,空间开少了,忘了high- low+1,在释放时就有了越界错误
解释
相信你...
原创
2019-03-07 19:07:28 ·
320 阅读 ·
0 评论