The default stack size is 1 Mb ... You can actually change it on a per
thread basis in 2.0 easily
http://geekswithblogs.net/gyoung/arc.../02/76961.aspx for win
XP/2003 (although most people change it down not up:)). The amount of stack
used per recursion actually depends on how many parameters/variables the
method has as the stack is where these arew stored.
btw Goran is on the money with wonderring what went wrong with design :)
Cheers,
Greg
"Göran Andersson" <gu***@guffa.com> wrote in message
news:eX**************@TK2MSFTNGP03.phx.gbl...
I believe that the stack is 2 MB by default. Each call stored a 4 byte
return address on the stack (and perhaps 4 more bytes for storing the
previous stack frame). That gives you no more than 500000 recursive calls.
If your code even comes near that number of calls, you should take a step
back and consider where the code design went wrong.
wansch wrote: Hello,
Iam quite new to programming and dont know enough about the stack.
My problem is if I call a recurcive function like in the code
TestCalc(100000),
I get at some integer argument size a stack overflow exception.
The recursion is not endless. But at 1000000 the exception is thrown.
What is limitation of the stack or how can I figure it out.
Are there restrictions about function calls?
Thanks for your answer.. :-)
Code Part:
private void TestCalc(int counter)
{
if (counter <= 0)
{
return;
}
TestCalc(counter - 1);
}
void BtnTestStart_Click(object sender, EventArgs e)
{
TestCalc(100000);
}