调试断言失败:_BLOCK_TYPE_IS_VALID
Debug assertion failed: _BLOCK_TYPE_IS_VALID
在 C++ 中的以下代码:
class Foo {
vector<Foo*> otherFoos;
};
int _tmain(int argc, _TCHAR* argv[])
{
Foo* data = new Foo[5];
delete data;
}
我收到以下错误:
我正在使用 Visual Studio 2013。我不知道我的代码有什么问题。
你应该写delete [] data;
。 delete
new
,delete[]
new[]
。
在 C++ 中的以下代码:
class Foo {
vector<Foo*> otherFoos;
};
int _tmain(int argc, _TCHAR* argv[])
{
Foo* data = new Foo[5];
delete data;
}
我收到以下错误:
我正在使用 Visual Studio 2013。我不知道我的代码有什么问题。
你应该写delete [] data;
。 delete
new
,delete[]
new[]
。