Stack Overflow

I got a stack overflow error in a datafield....

Strange - it worked fine. I've had it published for a year and over 1500 downloads. But I made a small change to a barrel function.

I called function A, that called function B that called the barrel function. It took maybe 30 mins or so, but would then abort, and the error was Stack Overflow.

This forum suggests recursion can case this. But I don't recurse. I must have just used up some pool of memory by expanding the barrel function a little?

Anyway, I think I solved it by denesting the calls. The code is cleaner that way anyway. We'll see next few rides.

First time I've seen a Stack Overflow.

  • I see some stackoverflows in one of my apps in the sim when I run it "as is". It works when I run it through the Prettier Monkey C optimizer. It looks like there's a very small stack size even for the newest devices. I don't have any recursion either, just function calls other function, that calls other function, ... No cyclic problem. Really, just too small stack

  • The number of parameter comes into play.  If you call "a" with X parameters. which calls "b" with Y parameters, which calls "c" with Z paraments, etc, you can run out of stack space (parameters go on the stack).  And since there is no virtual memory in CIQ, the stack can't grow, while at the same time, you don't want the stack space to be too large, as that takes away  from your app's memory.

  • Ah. I added one extra parameter to the barrel function. Thanks!