Android Question out of memory crash at _class_globals

sorex

Expert
Licensed User
Longtime User
Hello,

I notice 2 out of memory crashes in the dev console which seem to happen when the app starts and variables are initializing. (._class_globals)

How can I track in such case what the cause could be or is this just android that freaks out sometimes?

I don't load any heavy images or anything it's just ints,strings, panels and a font file.

The devices don't seem to be low end either with 1500 & 3000Mb memory ofcourse I don't know what they had free at that point.
 

sorex

Expert
Licensed User
Longtime User
B4X:
java.lang.OutOfMemoryError:

1.   at com.sorex.binairo.binarypuzzle_game._class_globals (binarypuzzle_game.java:736)
2.   at java.lang.reflect.Method.invokeNative (Native Method)
3.   at java.lang.reflect.Method.invoke (Method.java:515)
4.   at anywheresoftware.b4a.BA.raiseEvent2 (BA.java:169)
5.   at com.sorex.binairo.binarypuzzle_game.innerInitialize (binarypuzzle_game.java:23)
6.   at com.sorex.binairo.binarypuzzle_game._initialize (binarypuzzle_game.java:2137)
7.   at com.sorex.binairo.main._activity_create (main.java:356)
8.   at java.lang.reflect.Method.invokeNative (Native Method)
9.   at java.lang.reflect.Method.invoke (Method.java:515)
10.  at anywheresoftware.b4a.BA.raiseEvent2 (BA.java:169)
11.  at com.sorex.binairo.main.afterFirstLayout (main.java:102)
12.  at com.sorex.binairo.main.access$000 (main.java:17)
13.  at com.sorex.binairo.main$WaitForLayout.run (main.java:80)
14.   at android.os.Handler.handleCallback (Handler.java:733)
15.   at android.os.Handler.dispatchMessage (Handler.java:95)
16.   at android.os.Looper.loop (Looper.java:146)
17.   at android.app.ActivityThread.main (ActivityThread.java:5593)
18.   at java.lang.reflect.Method.invokeNative (Native Method)
19.   at java.lang.reflect.Method.invoke (Method.java:515)
20.   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1283)
21.   at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1099)
22.   at dalvik.system.NativeStart.main (Native Method)

I realize that these are exeptions because a few hundreds of people play it daily without any problem.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
that sub is something B4A ads, it not my own added one.
of is the error happening in binarypuzzle_game ?

I'll see if I can find a detokenizer to have a look at that line.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
but as that contains the variables and arrays it's probably code in the game class that does something wrong when writing to an array? (out of bounds or so)

as far as I can see one happends when requesting the size of a banner that might have not downloaded correctly it is in a try/catch tho does this mean it just logs the problem and that the app might have continued? (this banner thing has been removed in the current version)

the other one might be in an array rotate function where it went out of bounds.

I'll do some testing to see if I can make it crash here aswell.

thanks.
 
Upvote 0
Top