QB64 Phoenix Edition
Recursion Limit - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11)
+--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2)
+--- Thread: Recursion Limit (/showthread.php?tid=1706)

Pages: 1 2


RE: Recursion Limit - dbox - 05-29-2023

Yeah, I was really just altering the version Charlie was trying to run in qbjs.  It is really expected that with no delay to give control back to the display a runaway recursive function would just crash the system in qb64 or qbjs.

“With great power comes great responsibility.”
- Ben Parker


RE: Recursion Limit - pmackay - 10-17-2025

(05-28-2023, 02:04 PM)bplus Wrote: Ewh! disappointing that QB64pe dies in mid 18,000's BaCon and FreeBasic do way better...

https://rosettacode.org/wiki/Find_limit_of_recursion#BASIC

Here is code I checked with, maybe there is better?
Code: (Select All)
howRecursive 1
Sub howRecursive (i As _Integer64)
    If i < 0 Then Print "_Integer64 turned negative.": End
    Print i
    _Delay .000000000005
    howRecursive i + 1
End Sub

Maybe with manual stack?
is this same error across all OS, My program compiles fine on linux, but it crashes on windows / this is the text i received for my program    " Had a runtime error in Sub CarveMaze, due to recursion levels/out of stack space. Setting a ridiculous stack size in QB64PE's C++ Linker Flags took care of it. I did not try to find a minimum requirement, and the format of this option might be different on other operating systems (I'm on Windows). I think the default size is 2MB, so 4MB or 8MB might be enough, but I pasted in 128MB from a forum post.
C++ Linker Flags: -Wl,--stack,134217728
Note, after changing the Compiler or Linker option flags, the first time you compile or run a program QB64 PE will rebuild runtime libraries, which can take a few minutes. It just says "Building .exe file..."    https://www.facebook.com/share/p/17CKtMLKts/


RE: Recursion Limit - bplus - 10-17-2025

Man what a blast from the past! I had forgotten all about this post and topic.

thanks for the reminder @pmackay Smile


RE: Recursion Limit - pmackay - 10-17-2025

(10-17-2025, 11:12 AM)pmackay Wrote:
(05-28-2023, 02:04 PM)bplus Wrote: Ewh! disappointing that QB64pe dies in mid 18,000's BaCon and FreeBasic do way better...

https://rosettacode.org/wiki/Find_limit_of_recursion#BASIC

Here is code I checked with, maybe there is better?
Code: (Select All)
howRecursive 1
Sub howRecursive (i As _Integer64)
    If i < 0 Then Print "_Integer64 turned negative.": End
    Print i
    _Delay .000000000005
    howRecursive i + 1
End Sub

Maybe with manual stack?
is this same error across all OS, My program compiles fine on linux, but it crashes on windows / this is the text i received for my program    " Had a runtime error in Sub CarveMaze, due to recursion levels/out of stack space. Setting a ridiculous stack size in QB64PE's C++ Linker Flags took care of it. I did not try to find a minimum requirement, and the format of this option might be different on other operating systems (I'm on Windows). I think the default size is 2MB, so 4MB or 8MB might be enough, but I pasted in 128MB from a forum post.
C++ Linker Flags: -Wl,--stack,134217728
Note, after changing the Compiler or Linker option flags, the first time you compile or run a program QB64 PE will rebuild runtime libraries, which can take a few minutes. It just says "Building .exe file..."    https://www.facebook.com/share/p/17CKtMLKts/
I fixed it with a manual stack. done. windows now compiling no stack crash. //original file saved as running on linux no probs/stack recursion error on windows. alternate file with fix saved also working both windows and linux with same output as original.


RE: Recursion Limit - a740g - 10-17-2025

A wise man once said, "When you blow up the call stack, you should really question your life choices."