QB64 Phoenix Edition
QB64 crash!? - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://staging.qb64phoenix.com/forumdisplay.php?fid=10)
+---- Thread: QB64 crash!? (/showthread.php?tid=1314)



QB64 crash!? - eoredson - 12-21-2022

Try this code and tell me what happens..

btw: It does not display an error..

Code: (Select All)
Print clock$

Function clock$
  clock$ = "date/time is:"
  clock$ = clock$ + Date$ + " " + Time$
End Function



RE: QB64 crash!? - SMcNeill - 12-21-2022

It generates a never-ending recursive call back to clock$, which keeps adding Date$ and Time$ to clock$, until they grow so large, you run out of memory and stack space and crash.


RE: QB64 crash!? - johannhowitzer - 12-21-2022

I don't even need to run it to tell what will happen - the second line of the function is recursively calling the function, which repeats infinitely.  Change the function to do this instead:

c$ = "date/time is:"
clock$ = c$ + date$ + " " + time$


RE: QB64 crash!? - SMcNeill - 12-21-2022

Code: (Select All)
Print clock$

Function clock$
    _Delay .001
    Static count
    count = count + 1
    Print count; "recursive calls in..."
    clock$ = "date/time is:"
    clock$ = clock$ + Date$ + " " + Time$
End Function


[Image: image.png]


14,415 recursive calls to the function, and then it crashes for me. Wink


RE: QB64 crash!? - Pete - 12-21-2022

Time after time, time after time, time after time...

- Cindi Lauper


RE: QB64 crash!? - eoredson - 01-10-2023

(12-21-2022, 04:26 AM)SMcNeill Wrote: It generates a never-ending recursive call back to clock$, which keeps adding Date$ and Time$ to clock$, until they grow so large, you run out of memory and stack space and crash.

My question was that since the following code crashes with an Out Of Memory box:

Code: (Select All)
Dim Large(1024, 1024, 1024, 1024) As Double

Obviously because you can't assign an 8 Terabyte array,

then why can't QB64 display an Out Of Stack box??

Erik.