Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Recursion Limit
#11
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
Reply
#12
(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_...sion#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/
Reply
#13
Man what a blast from the past! I had forgotten all about this post and topic.

thanks for the reminder @pmackay Smile
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#14
(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_...sion#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.
Reply
#15
A wise man once said, "When you blow up the call stack, you should really question your life choices."
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Feature Request: Limit Scope of a "Find" and "Change" hanness 5 706 06-21-2025, 11:21 PM
Last Post: SMcNeill
  Recursion limit? TerryRitchie 5 1,157 03-12-2024, 02:17 PM
Last Post: GareBear
  Stack size limit for If/Then statements? JamesAlexander 20 3,598 01-31-2024, 06:21 PM
Last Post: Kernelpanic

Forum Jump:


Users browsing this thread: 1 Guest(s)