Function getting stack overflow error and I don't know why.
-
I am getting the following error:
'stack overflow. Too many functions called, maximum memory for variables exceeded (context: 1ED77000)'My game code (which is tiny right now) only calls one function and that function is 'getinput' and is used to rotate and move the player.
This is the function
If I run my game, although it works fine, some 30-40 seconds laters I get that error.
if I comment out the function in the main loop so it does not run then the game simply does not error.What am I doing wrong in the function to generate the error?
-
Nothing wrong.
I had the same error with controls(), see this post :
https://fuzearena.com/forum/topic/107/stack-overflow-with-controls-nSee if you have global variable named "c" , then rename it, or comment the line.
Maybe the same with r, but not tested. -
Steve - you're doing nothing wrong and we are aware of this error. It is fixed and will be added in an upcoming patch.
For the time being, could you try doing the
c = controls(0)
in your main loop? I set up my programs this way and it doesn't seem to trigger the stack overflow for me.c = controls(0) // main loop loop c = controls(0) clear() getinput() update() repeat function getinput() // don't call controls() here return void
I'm interested to see if this works for you.
-
Thanks Dave, sadly it's still giving me the error. weird huh?
Maybe I'll just take the code out of the function and stick it in the main loop and see if it still does it.Hells bells.. I even get the error when the code is in the main loop and not in a function.
(I find it more than a little strange that its giving me 'too many functions called' when my code is now not calling any functions at all.) -
Try changing it so that (in pseudo-code)
increment = 0 if c.a then increment = 3 if c.b then increment = -3 setspriterotation(sprite, r + increment)
That way the setspriterotation is not called within a conditional block
-
It seems this is a rare bug in Fuze. I've even tried commenting out each part and testing it (ie the rotate part, then move, then draw) but it crashes every time regardless.
so it's a case of wait for the next patch. Thanks anyway everyone! -
Could some kind and possibly bored person type in the example code at the bottom of this page.
https://fuzearena.com/help/view/getSpriteSpeedI tried to use that instead of my code and I'm still getting stack overflow and now I'm beginning to suspect an issue with my Switch itself.
-
@SteveZX81 There is no need to type it. You can copy it from the help page and then paste it into your code. I have just done this and I'm afraid it is working for me
-
It does work but did you leave it running for like 30 secs? if you did then I guess I do have a switch problem. Thanks anyway
-
@SteveZX81 I will try that now
-
@SteveZX81 Seems OK to me. I assume that you have the patch installed? Have you tried it after a restart of Fuze?
-
Yes and yes. I even did a hard reset earlier. Thanks anyway. I think we've found the problem.
-
Steve. Please let me try this later also as I still fail to see how this can be a problem with your Switch. Given we’re seeing the same issues elsewhere I’m really curious now!
-
Same prolem with my game, i think i will just wait for the patch since it will mean apply too mutch changes to the code