如何克服与Visual Studio堆栈大小的问题(运行C codeS大数组) [英] How to overcome Stack Size issue with Visual Studio (running C codes with big array)
问题描述
我使用Visual Studio 13编译C codeS的第一次。在codeS完美运行O.K.用大小为64 * 64的2D一阳(有在我的计划了几个阵列),但如果我增加数组的大小为128 * 128不运行(但正确编译)。相反,它给出了一个消息,名为.exe已停止工作。我的机器有4GB内存和128×128阵列相同的程序运行,如果我运行Linux下C $ CS的$。
I am using Visual Studio 13 to compile c codes for the first time. The codes run perfectly O.K. with 2d arays of size 64*64 (there are a few arrays in my programme) but if I increase the array size to 128*128 it does not run (but compile correctly). Instead it gives a message ".exe has stopped working". My machine has 4GB ram and the same programme run with 128*128 array if I run the codes from linux.
让我提供一些更多的细节:我已在同一台机器采用了Intel C编译器(非商业版本)运行从Linux一样code。但由于一些问题,我现在受限于在Windows环境中工作。我搜索和安装了两个C-编译器(1)的Visual Studio 13和(2)的Borland C.用两个小阵工作。但我增加数组大小的Visual Studio给消息的时刻的.exe已停止工作。我编译使用CL从程序开发商命令提示符VS 13。
Let me provide some more details: I have run the same code from linux using Intel C Compiler (non-commercial version) in the same machine. But due to some problem I am now constrained to work from a Windows environment. I searched and have installed two c- compilers (1) Visual Studio 13 and (2) Borland C. Both work well with a small array. But the moment I increase array size Visual Studio give the message ".exe has stopped working". I compile the programme using 'cl' from "Developers Command Prompt VS 13".
我觉得这个问题是堆栈大小。
I feel the problem is with stack size.
在链接详细解释(如下规定),我看到了命令在Linux环境中使用,以增加堆栈大小的ulimit。我记得几年前使用它。
In the link detailed explanation (as provided below) I have seen a command "ulimit" used in linux environment to increase the stack size. I remember using it a few years ago.
我觉得我们已经接近解决方案,但我使用Windows(和VS 2013)问题仍然存在,因为我未能执行 DUMPBIN /头executable_file
或 EDITBIN / STACK:尺寸
。其实我觉得我不知道如何执行这些操作。我试图从开发人员命令提示符VS 13,以及使用运行执行它们(windows启动自下而上>搜索(运行) - >运行(托))。我请你到好心如果可能提供更多的细节。
I feel we are close to the solution, but my problem with Windows (and VS 2013) persists as I failed to execute dumpbin /headers executable_file
or editbin /STACK:size
. Actually I feel I do not know how to execute them. I tried to execute them from "Developer Command Prompt VS 13" as well as using Run (windows start bottom->search (run)->Run (prop up)). I request you kindly to provide more details if possible.
我搜索,发现这个网站,并在这里想办法可以解决。
I searched and found this website and think here the solution can be found.
请帮忙。我想使用Visual Studio 13从Windows运行。
Please help. I want to run using Visual Studio 13 from Windows.
推荐答案
看来,这背后的原因是堆栈溢出。这个问题可以通过增加栈大小来解决。结果
在Visual Studio中您可以使用 / STACK做到这一点:储备[,提交]
。阅读 MSDN文章。
It seems that the reason behind this is the stack overflow. The issue can be resolved by increasing the stack size.
In visual studio you can do this by using /STACK:reserve[,commit]
. Read the MSDN article.
有关更多详细的解释:
在Windows平台上,堆栈尺寸信息被包含在可执行文件。它可以在Visual Studio C ++编译期间进行设置。结果
另外,微软提供了一个程序 editbin.exe
可改变
直接可执行文件。以下是详细信息:
Under Windows platforms, the stack size information is contained in the executable files. It can be set during compilation in Visual studio C++.
Alternatively, Microsoft provides a program editbin.exe
which can change the
executable files directly. Here are more details:
的Windows(编译期间):
- 选择
项目 - >设置
。 - 选择
链接
页。 - 选择
类别,以输出
。 - 在
后备式的preferred堆栈大小:
在字段栈
。例如,
分配32768
十进制或地址0x20000
十六进制的。
- Select
Project->Setting
. - Select
Link
page. - Select
Category to Output
. - Type your preferred stack size in
Reserve:
field underStack allocations
. eg,32768
in decimal or0x20000
in hexadecimal.
的Windows(修改可执行文件):
有包含在Microsoft Visual Studio两种方案, DUMPBIN.EXE
和 editbin.exe
。运行 DUMPBIN /头executable_file
,你可以看到在的
。运行堆栈储备尺寸
信息可选报头值 EDITBIN / STACK:尺寸
来改变默认的堆栈大小
There are two programs included in Microsoft Visual Studio, dumpbin.exe
and editbin.exe
. Run dumpbin /headers executable_file
, and you can see the size of stack reserve
information in optional header values
. Run editbin /STACK:size
to change the default stack size.
这篇关于如何克服与Visual Studio堆栈大小的问题(运行C codeS大数组)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!