Friday, October 10, 2003 1:09 AM
richard
Would you like to biggie-size your stack?
A recent thread in the C# newsgroup yielded this cool tip that I didn't know (oh all the things I've missed not being a VC++ developer). This will allow you to actually increase the stack size for any given .NET executable - very significantly if you need it. Note that you may need to have Visual C++ installed to have the Editbin.exe utility used below. Here's the test code:
using System;
namespace SuperStackSize1
{
public class StackTest
{
private static long _Depth = 0;
public static void GoDeep()
{
if ((++_Depth % 10000) == 0) System.Console.WriteLine("Depth is " +
_Depth.ToString());
GoDeep();
return;
}
static void Main(string[] args)
{
try
{
StackTest.GoDeep();
}
catch
{
Console.WriteLine("end of prog");
Console.ReadLine();
}
finally {}
}
}
}And here's the .NET command line to pump up the stack:
editbin /stack:4000000 SuperStackSize1.exe
Try it 'before' and 'after' - just remember to run your app from the command line to prevent VS.NET from re-compiling.