Find limit of recursion: Difference between revisions
Content added Content deleted
m (→{{header|Ruby}}: whitespace) |
m (global whitespace) |
||
Line 346: | Line 346: | ||
here we see that the function call stack size is 262067. |
here we see that the function call stack size is 262067. |
||
=={{header|Oz}}== |
=={{header|Oz}}== |
||
Line 394: | Line 393: | ||
=={{header|PowerShell}}== |
=={{header|PowerShell}}== |
||
Both of these examples will throw an exception when the recursion depth is exceeded, however, the exception cannot be trapped in the script. |
Both of these examples will throw an exception when the recursion depth is exceeded, however, the exception cannot be trapped in the script. |
||
The exception thrown on a Windows 2008 x64 system is |
The exception thrown on a Windows 2008 x64 system is |
||
Line 427: | Line 425: | ||
The recursion limit is primarily determined by the stack size. The stack size can be changed when compiling a program by specifying the new size using '/stack:NewSize' in the linker file. |
The recursion limit is primarily determined by the stack size. The stack size can be changed when compiling a program by specifying the new size using '/stack:NewSize' in the linker file. |
||
===Procedural=== |
|||
In addition to the stack size the recursion limit for procedures is further limited by the procedure's parameters and local variables which are also stored on the same stack. |
In addition to the stack size the recursion limit for procedures is further limited by the procedure's parameters and local variables which are also stored on the same stack. |
||
Line 438: | Line 436: | ||
Stack overflow after 86317 recursions on x86 Vista. |
Stack overflow after 86317 recursions on x86 Vista. |
||
===Classic=== |
|||
<lang PureBasic>rec: |
<lang PureBasic>rec: |
||
PrintN(str(n)) |
PrintN(str(n)) |
||
Line 542: | Line 540: | ||
Got to depth 999999 |
Got to depth 999999 |
||
</pre> |
</pre> |
||
=={{header|UNIX Shell}}== |
=={{header|UNIX Shell}}== |
||
Line 564: | Line 561: | ||
The Bash reference manual says <cite>No limit is placed on the number of recursive calls</cite>, nonetheless a segmentation fault occurs at 13777 (Bash v3.2.19 on 32bit GNU/Linux) |
The Bash reference manual says <cite>No limit is placed on the number of recursive calls</cite>, nonetheless a segmentation fault occurs at 13777 (Bash v3.2.19 on 32bit GNU/Linux) |
||
=={{header|VBScript}}== |
=={{header|VBScript}}== |
||
Haven't figured out how to see the depth. And this depth is that of calling the O/S rather than calling within. |
Haven't figured out how to see the depth. And this depth is that of calling the O/S rather than calling within. |
||