Hi all!
My code causes java.lang.StackOverflowError. The code consists of many subs and classes so I think at first I'm asking for help to interpret the log. See copy of the log below.
I think that the stack is a memory area. When a sub is invoked the arguments is placed at the top of the stack. If a new sub is started by the first sub, the arguments is laid on top of the arguments for the calling sub. When a sub is finished the arguments to the sub are removed from the stack and memory is released. Is this correct? Is it other things that can be stored on the stack?
The reason Stack Overflow error may then be:
1) The subs are too deeply nested. a sub starting another sub starting another sub etc etc
2) A sub calls itself multiple times
Could there be other reasons for Stack Overflow Error?
After the line "java.lang.StackOverflowError" is an amount of lines beginning with "at". What does the part after the "at" mean?
Is it references to sub-calls? I can not relate it to the code I created. At the end of the line is a number, is it a line number in the code?
Thanks Knut
My code causes java.lang.StackOverflowError. The code consists of many subs and classes so I think at first I'm asking for help to interpret the log. See copy of the log below.
I think that the stack is a memory area. When a sub is invoked the arguments is placed at the top of the stack. If a new sub is started by the first sub, the arguments is laid on top of the arguments for the calling sub. When a sub is finished the arguments to the sub are removed from the stack and memory is released. Is this correct? Is it other things that can be stored on the stack?
The reason Stack Overflow error may then be:
1) The subs are too deeply nested. a sub starting another sub starting another sub etc etc
2) A sub calls itself multiple times
Could there be other reasons for Stack Overflow Error?
After the line "java.lang.StackOverflowError" is an amount of lines beginning with "at". What does the part after the "at" mean?
Is it references to sub-calls? I can not relate it to the code I created. At the end of the line is a number, is it a line number in the code?
Thanks Knut
B4X:
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
startService: class knutf.pumpestyring.servicepumpe
** Service (servicepumpe) Create **
** Service (servicepumpe) Start **
servicepumpe$_startwritevaluetom3argumentstoString (B4A line: 173)
TimerTimeoutCom.Enabled = True
java.lang.StackOverflowError
at java.lang.String._getChars(String.java:1040)
at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:155)
at java.lang.IntegralToString.convertInt(IntegralToString.java:202)
at java.lang.IntegralToString.appendInt(IntegralToString.java:166)
at java.lang.StringBuilder.append(StringBuilder.java:140)
at anywheresoftware.b4a.objects.ViewWrapper.toString(ViewWrapper.java:277)
at anywheresoftware.b4a.objects.TextViewWrapper.toString(TextViewWrapper.java:69)
at java.lang.String.valueOf(String.java:1860)
at anywheresoftware.b4a.BA.TypeToString(BA.java:583)
at anywheresoftware.b4a.B4AClass$ImplB4AClass.toString(B4AClass.java:30)
at java.lang.StringBuilder.append(StringBuilder.java:203)
at java.util.AbstractCollection.toString(AbstractCollection.java:384)
at anywheresoftware.b4a.AbsObjectWrapper.toString(AbsObjectWrapper.java:110)
at java.lang.String.valueOf(String.java:1860)
at anywheresoftware.b4a.BA.TypeToString(BA.java:583)
at anywheresoftware.b4a.B4AClass$ImplB4AClass.toString(B4AClass.java:30)
at java.lang.String.valueOf(String.java:1860)
at anywheresoftware.b4a.BA.TypeToString(BA.java:583)
at anywheresoftware.b4a.B4AClass$ImplB4AClass.toString(B4AClass.java:30)
at java.lang.StringBuilder.append(StringBuilder.java:203)
at java.util.AbstractCollection.toString(AbstractCollection.java:384)
at anywheresoftware.b4a.AbsObjectWrapper.toString(AbsObjectWrapper.java:110)
at java.lang.String.valueOf(String.java:1860)
at anywheresoftware.b4a.BA.TypeToString(BA.java:583)
at anywheresoftware.b4a.B4AClass$ImplB4AClass.toString(B4AClass.java:30)
at java.lang.String.valueOf(String.java:1860)
at anywheresoftware.b4a.BA.TypeToString(BA.java:583)
at anywheresoftware.b4a.B4AClass$ImplB4AClass.toString(B4AClass.java:30)
at java.lang.StringBuilder.append(StringBuilder.java:203)
at java.util.AbstractCollection.toString(AbstractCollection.java:384)
at anywheresoftware.b4a.AbsObjectWrapper.toString(AbsObjectWrapper.java:110)
at java.lang.String.valueOf(String.java:1860)
at anywheresoftware.b4a.BA.TypeToString(BA.java:583)
at anywheresoftware.b4a.B4AClass$ImplB4AClass.toString(B4AClass.java:30)
at java.lang.String.valueOf(String.java:1860)
at anywheresoftware.b4a.BA.TypeToString(BA.java:583)
at anywheresoftware.b4a.B4AClass$ImplB4AClass.toString(B4AClass.java:30)
at java.lang.StringBuilder.append(StringBuilder.java:203)
at java.util.AbstractCollection.toString(AbstractCollection.java:384)
at anywheresoftware.b4a.AbsObjectWrapper.toString(AbsObjectWrapper.java:110)
at java.lang.String.valueOf(String.java:1860)
at anywheresoftware.b4a.BA.TypeToString(BA.java:583)
at anywheresoftware.b4a.B4AClass$ImplB4AClass.toString(B4AClass.java:30)
at java.lang.String.valueOf(String.java:1860)
at anywheresoftware.b4a.BA.TypeToString(BA.java:583)
at anywheresoftware.b4a.B4AClass$ImplB4AClass.toString(B4AClass.java:30)
at java.lang.StringBuilder.append(StringBuilder.java:203)
at java.util.AbstractCollection.toString(AbstractCollection.java:384)
at anywheresoftware.b4a.AbsObjectWrapper.toString(AbsObjectWrapper.java:110)
at java.lang.String.valueOf(String.java:1860)
at anywheresoftware.b4a.BA.TypeToString(BA.java:583)
at anywheresoftware.b4a.B4AClass$ImplB4AClass.toString(B4AClass.java:30)
at java.lang.String.valueOf(String.java:1860)
at anywheresoftware.b4a.BA.TypeToString(BA.java:583)
at anywheresoftware.b4a.B4AClass$ImplB4AClass.toString(B4AClass.java:30)
at java.lang.StringBuilder.append(StringBuilder.java:203)
at java.util.AbstractCollection.toString(AbstractCollection.java:384)
at anywheresoftware.b4a.AbsObjectWrapper.toString(AbsObjectWrapper.java:110)
at java.lang.String.valueOf(String.java:1860)
at anywheresoftware.b4a.BA.TypeToString(BA.java:583)
at anywheresoftware.b4a.B4AClass$ImplB4AClass.toString(B4AClass.java:30)
at java.lang.String.valueOf(String.java:1860)
at anywheresoftware.b4a.BA.TypeToString(BA.java:583)
at anywheresoftware.b4a.B4AClass$ImplB4AClass.toString(B4AClass.java:30)
at java.lang.StringBuilder.append(Str