简体   繁体   English

如何在 Visual Studio C++ 中增加堆栈大小?

[英]How do I increase the stack size in Visual Studio C++?


I am writing a program where it is necessary to compute the entries of anxn matrix with n=1000.我正在编写一个程序,其中需要计算 n=1000 的 anxn 矩阵的条目。

If I write the following two lines in my code, I will get a stackoverflow error message:如果我在代码中编写以下两行代码,我将收到 stackoverflow 错误消息:

const int n = 1000;

double matrix[n][n];

Error message:错误信息:

Exception error at 0x010E1ED9 in Cubic spline.exe: 0xC00000FD: Stack overflow (Parameter: 0x00000000, 0x00292000) Cubic spline.exe 中 0x010E1ED9 处的异常错误:0xC00000FD:堆栈溢出(参数:0x00000000、0x00292000)

How can I increase the stack size or do you think there is another way to solve the problem?我怎样才能增加堆栈大小或者你认为有另一种方法来解决这个问题?

Visual Studio uses 4KB for the stack but reserved 1MB by default. Visual Studio 使用 4KB 用于堆栈,但默认保留 1MB。 You can change this in "Configuration Properties"->Linker->System->"Stack Reserve Size" to 10MB for example.例如,您可以在“配置属性”->链接器->系统->“堆栈保留大小”中将其更改为 10MB。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM