views:

120

answers:

2

With the StackOverflowException are the conditions to be thrown hardcoded or dependent on the machine the code is running on?

I am almost certain the latter but have failed in my searches and don't ask enough questions here.

+5  A: 

From the documentation:

... is thrown when the execution stack overflows because it contains too many nested method calls.

Since the size of the stack is architecture-dependent and can even be overridden on a machine, yes, this value is not hard-coded, though it is generally pretty static on Windows. If I remember correctly, it is 1MB in size by default.

Lee
+1. Good answer.
David Stratton
+2  A: 

Although not a perfect match for your question, see also:

http://stackoverflow.com/questions/1042345/how-do-you-change-default-stack-size-for-managed-executable-net

Philippe Leybaert