StackOverflowExceptionStackOverflowException

2023-09-03 16:58:39 作者:空白了的回忆

随着StackOverflowException的条件抛出硬codeD或依赖于code正在运行的机器上?

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.

推荐答案

从的文件:

...时执行堆栈溢出,因为它包含了太多的嵌套的方法调用抛出。

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

由于堆栈的大小依赖于架构的,甚至可以在计算机上覆盖,是的,这个值是不是硬codeD,虽然普遍pretty的静态在Windows上。如果我没有记错,这是1MB大小的默认。

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.