[英]Debug assertion failed: _BLOCK_TYPE_IS_VALID
in C++ on following code: 在C ++中的以下代码中:
class Foo {
vector<Foo*> otherFoos;
};
int _tmain(int argc, _TCHAR* argv[])
{
Foo* data = new Foo[5];
delete data;
}
I get this following error: 我收到以下错误消息:
I'm using Visual Studio 2013. I have no idea what is wrong with my code whatsoever. 我正在使用Visual Studio2013。我不知道我的代码有什么问题。
You should write delete [] data;
您应该写入
delete [] data;
. 。
delete
for new
, delete[]
for new[]
. delete
了new
, delete[]
为new[]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.