B4J Question stack overflow

sorex

Expert
Licensed User
Longtime User
Hello,

Are there any stack flushing options that we can use?

I have a routine that does some recursive calls.

All works fine the first time.

When I run it again it halfway ends with a stack overflow error.

When I add some startsub/endsub logging I see that it ends all sub calls at the first run so the stacks should be as before pressing the button.
 

sorex

Expert
Licensed User
Longtime User
ok, I found the culprit :)

changing

B4X:
Sub scan(X,Y,c)

to

B4X:
Sub scan(X as int,Y as int,c as int)

makes the stack overflow go away.

doesn't make sense but I guess it's starting a lot of background subs (stringbuilers etc) when the type is undefined thus string.
 
Upvote 0
Top