Clion 退出代码 -1073741571 (0xC00000FD)
Clion exit code -1073741571 (0xC00000FD)
我在 clion 中得到一个奇怪的退出代码:
exit code -1073741571 (0xC00000FD)
这是我的代码:
int main()
{
std::cin.sync_with_stdio(false);
std::cin.tie(nullptr);
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int n = 0, i = 0, j = 0;
int arr[30007][5];
for (i = 1; i <= 30000; i++)
arr[0][i] = 1;
//...
return 0;
}
我测试了一下,发现是因为这条线:
int arr[30007][5];
2 天前声明大小小于 1.000.000 的数组没有问题,现在我收到此错误。
我在 Clion 中没有做任何更改。
我该怎么办?
错误号0xC00000FD
代表"stack overflow"(我想你的平台是Windows)。在 Windows 下,局部变量分配在堆栈上(在大多数其他平台上也是如此)并且 int arr[30007][5]
相当大(30007 * 5 * 4 = 600140 字节)并且堆栈通常相当小(通常约为 1 Mb,再次依赖于平台)
你有很多选择:
- 使用
std::vector
代替原始数组(首选)
- 将数组声明为静态 (
static int arr[30007][5];
),然后它将不再驻留在堆栈中
- 增加可执行文件的堆栈大小。这高度 platform/too 依赖。
- 动态分配数组
我在 clion 中得到一个奇怪的退出代码:
exit code -1073741571 (0xC00000FD)
这是我的代码:
int main()
{
std::cin.sync_with_stdio(false);
std::cin.tie(nullptr);
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int n = 0, i = 0, j = 0;
int arr[30007][5];
for (i = 1; i <= 30000; i++)
arr[0][i] = 1;
//...
return 0;
}
我测试了一下,发现是因为这条线:
int arr[30007][5];
2 天前声明大小小于 1.000.000 的数组没有问题,现在我收到此错误。 我在 Clion 中没有做任何更改。
我该怎么办?
错误号0xC00000FD
代表"stack overflow"(我想你的平台是Windows)。在 Windows 下,局部变量分配在堆栈上(在大多数其他平台上也是如此)并且 int arr[30007][5]
相当大(30007 * 5 * 4 = 600140 字节)并且堆栈通常相当小(通常约为 1 Mb,再次依赖于平台)
你有很多选择:
- 使用
std::vector
代替原始数组(首选) - 将数组声明为静态 (
static int arr[30007][5];
),然后它将不再驻留在堆栈中 - 增加可执行文件的堆栈大小。这高度 platform/too 依赖。
- 动态分配数组