17 February 2021, 00:07 | #1 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
Out of Stack Space Error
Hi - so have discovered I have a game killing error - out of stack space.
At first I thought it might be because I am jumping out of for next loops and I read the manual that said I needed to pop for if this is the case. I have found them all I think. Does anyone know what else might cause this error so I can root it out! Have checked a much earlier version of my Space Invaders and I still get the error so it's been there for a while but only shows itself if you play the game through a few times. Thanks in advance for any help you can offer. |
17 February 2021, 10:12 | #2 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
I've never run into it myself - are you doing any sort of recursion? Jumping with Gosub without returns? Jumping out of a Select block without returning? It sounds like something's not happening in the right order, and you're just building a massive stack without clearing it.
|
17 February 2021, 14:24 | #3 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
Thanks - that's what I am think. Error doesn't even appear int he Blitz manual that I have! No selects but some gosubs (sorry bit old school as learnt to program from the ZX Spectrum manual).
I'll have to work my way slowly through the code - it's something that has always been there so I may be able to go back to earlier (less spaghetti) code to hunt it out! |
17 February 2021, 15:29 | #4 |
Banned
Join Date: Aug 2005
Location: London / Sydney
Age: 47
Posts: 20,420
|
I'm sure I had this when looking at Brick Nash's Streets of Rage.
...nope, just checked, it was: Ooops, and that was AMOS; not Blitz Basic |
17 February 2021, 15:46 | #5 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
There's nothing wrong with a Gosub (or even a Goto, for that matter) if it's used responsibly and with good reason They're a bit old skool and can lead to difficult to debug situations, weird bugs and tricky to follow code, but they're also faster than using functions, and in game terms on stock hardware, that speed difference can be important.
Make sure every Gosub is terminated with a Return, and that if you leave the Gosub for anything, you Return back into it before Returning to the previous point. If you really need to, you can Pop out of a Gosub stack, but I think such a situation could easily be handled some other way. |
17 February 2021, 15:52 | #6 | |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
Quote:
|
|
17 February 2021, 15:52 | #7 | |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
Quote:
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how can I save some stack space? | litwr | Coders. General | 2 | 18 September 2020 19:47 |
[Found: Space Baller] Bouncing ball in space? | Kada | Looking for a game name ? | 23 | 06 April 2018 03:10 |
Space Quest : Read Write error | coze | project.Killergorilla's WHD packs | 1 | 20 July 2015 12:39 |
How much stack space do we need? | AGS | Coders. System | 3 | 18 March 2015 17:00 |
ERROR: Plan 9 from Outer Space (Illegal Instruction) | Dwyloc | project.Killergorilla's WHD packs | 1 | 26 July 2009 12:51 |
|
|