Call stack more limited on Xbox 360 than Windows?

Hi,

I am working on a program that uses heavy recursion. It works fine on Windows but is causing problems on the Xbox 360.

I switched to a very simple test app. It is just the default "Windows Game" or "Xbox 360 Game", with the following additional method:

public void TestRecursion(int level)
{
if (level >= 14000)
return;
else
TestRecursion(level + 1);
}

And I call TestRecursion(0) from Game1.Initialize().

On Windows, I don't get a stack overflow error til somewhere between 13000 and 14000.

On the Xbox 360, if I go somewhere between 900 and 1000, I get this error:

The remote connection to the device has been lost. Please verify the device connection and restart debugging.

Is there a hardcoded stack depth of 1000 on the 360? Or just a smaller total system stack size? Is there a way to alter the stack size?

I can rewrite my algorithm to use its own stack instead of recursion...but it makes me grumpy.

Thanks,

-Mike

[1359 byte] By [manders] at [2007-12-29]
# 1
The general concensus seems to be that the desktop CLR has a default stack size of 1mb and the compact CLR has a default of 128k. So it seems likely that extreme recursion will break earlier on the compact framework.

It is possible to change the stack size when you create a Thread but not once a Thread is running.

I can understand your grumpiness but needing to recurse into a method over a 1000 times seems an extreme situation.

Cheers,
Leaf.

Leaf. at 2007-9-4 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 2

Thanks Leaf.

I was able to change the code to use my own stack and it worked the first time, so my grumpiness didn't last long. It's good to know those details about the CLR's system stack.

-Mike

http://www.despair.com/mis24x30prin.html

manders at 2007-9-4 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...