如何更改堆栈大小的.NET程序? [英] How to change stack size for a .NET program?
问题描述
我有一个程序,做2十亿倍和堆栈溢出递归调用。我做出改变,然后它仍然需要40K递归调用。所以,我可能需要几MB的堆栈内存。听说堆栈大小默认为1MB。我试着在网上搜索。有的人说去属性 - >连接器.........在Visual Studio中,但我无法找到它
I have a program that does recursive calls for 2 billion times and the stack overflow. I make changes, and then it still need 40K recursive calls. So I need probably several MB stack memory. I heard the stack size is default to 1MB. I tried search online. Some one said to go properties ->linker .........in visual studio, but I cannot find it.
有谁知道如何增加的呢?另外我想知道如果我能在我的C#程序的地方设置呢?
Does anybody knows how to increase it? Also I am wondering if I can set it somewhere in my C# program?
P.S。我使用32位的winXP和64位的win7。
P.S. I am using 32-bit winXP and 64bit win7.
推荐答案
设置从.NET 2.0的堆栈大小的最简单方法和Win XP操作系统是产卵的堆栈大小一个新的线程,你想: -
The easiest way to set the stack size from .NET 2.0 and Win XP onwards is to spawn a new thread with the stack size you'd like:-
using System.Threading;
Thread T = new Thread(threadDelegate, stackSizeInBytes);
T.Start();
要改变整个程序的堆栈大小,你不得不使用EDITBIN: -
To change the stack size of the entire program you'd have to use editbin:-
EDITBIN.EXE /STACK:<stacksize> file.exe
这篇关于如何更改堆栈大小的.NET程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!