Hi all
My app is experiencing a lot of crashes on some devices due to out-of-memory error.
It is appearing sometimes ad especially when loading maps.
I can't deal with this out-of-memory error and i can't understand where and how to solve this problem.
My app opens some panels, and loads some images (about 10 images) with LoadBitMapSample. When i show also a map it crashes randomly e more frequently with errors like the following ones:
My thoughts are: why my "simple" app crashes so frequently and others like Facebook, Google plus, Instagram etc. that are more heavy than mine doesn't crash at all?
Where I am failing in programming?
Anyone that suffered from the same problem can me point in the right direction?
Thanks!
My app is experiencing a lot of crashes on some devices due to out-of-memory error.
It is appearing sometimes ad especially when loading maps.
I can't deal with this out-of-memory error and i can't understand where and how to solve this problem.
My app opens some panels, and loads some images (about 10 images) with LoadBitMapSample. When i show also a map it crashes randomly e more frequently with errors like the following ones:
B4X:
I/dalvikvm-heap(28148): Clamp target GC heap from 66.376MB to 64.000MB
D/dalvikvm(28148): GC_FOR_ALLOC freed 84K, 11% free 58531K/65536K, paused 28ms, total 28ms
I/dalvikvm-heap(28148): Forcing collection of SoftReferences for 3240016-byte allocation
I/dalvikvm-heap(28148): Clamp target GC heap from 66.376MB to 64.000MB
D/dalvikvm(28148): GC_BEFORE_OOM freed 0K, 11% free 58531K/65536K, paused 35ms, total 35ms
E/dalvikvm-heap(28148): Out of memory on a 3240016-byte allocation.
I/dalvikvm(28148): "main" prio=5 tid=1 RUNNABLE
I/dalvikvm(28148): | group="main" sCount=0 dsCount=0 obj=0x418ff5a8 self=0x401436a8
I/dalvikvm(28148): | sysTid=28148 nice=0 sched=0/0 cgrp=apps handle=1075138556
I/dalvikvm(28148): | state=R schedstat=( 19914758871 17748812518 35060 ) utm=1679 stm=311 core=3
I/dalvikvm(28148): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
I/dalvikvm(28148): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:623)
I/dalvikvm(28148): at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.InitializeSample(CanvasWrapper.java:550)
I/dalvikvm(28148): at anywheresoftware.b4a.keywords.Common.LoadBitmapSample(Common.java:1172)
I/dalvikvm(28148): at test.app.main._caricaprofiloutentetrovatodacache(main.java:2000)
I/dalvikvm(28148): at test.app.main._visualizzaprofiloutentetrovatodacontatti(main.java:8084)
I/dalvikvm(28148): at test.app.main._pannelliutentiinlista_touch(main.java:5658)
I/dalvikvm(28148): at java.lang.reflect.Method.invokeNative(Native Method)
I/dalvikvm(28148): at java.lang.reflect.Method.invoke(Method.java:525)
I/dalvikvm(28148): at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
I/dalvikvm(28148): at anywheresoftware.b4a.BA$1.run(BA.java:293)
I/dalvikvm(28148): at android.os.Handler.handleCallback(Handler.java:730)
I/dalvikvm(28148): at android.os.Handler.dispatchMessage(Handler.java:92)
I/dalvikvm(28148): at android.os.Looper.loop(Looper.java:176)
I/dalvikvm(28148): at android.app.ActivityThread.main(ActivityThread.java:5419)
I/dalvikvm(28148): at java.lang.reflect.Method.invokeNative(Native Method)
I/dalvikvm(28148): at java.lang.reflect.Method.invoke(Method.java:525)
I/dalvikvm(28148): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
I/dalvikvm(28148): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
I/dalvikvm(28148): at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm(28148):
D/skia (28148): --- decoder->decode returned false
I/dalvikvm-heap(28148): Clamp target GC heap from 66.357MB to 64.000MB
D/dalvikvm(28148): GC_EXPLICIT freed 20K, 11% free 58511K/65536K, paused 2ms+5ms, total 40ms
I/B4A (28148): Downsampling image due to lack of memory: 2
I/Choreographer(28148): Skipped 186 frames! The application may be doing too much work on its main thread.
My thoughts are: why my "simple" app crashes so frequently and others like Facebook, Google plus, Instagram etc. that are more heavy than mine doesn't crash at all?
Where I am failing in programming?
Anyone that suffered from the same problem can me point in the right direction?
Thanks!