I have created a xamarin project with forms. Where I have created a custom
Tabbar in which I am changing the Detail page when any tab button is tapped
using the MasterDetail page. After changing this.Detail = myPage three to four
times I get
the following message and application is crashed:
[dalvikvm-heap] Grow heap (frag case) to 116.928MB for 1255984-byte allocation
[dalvikvm-heap] Grow heap (frag case) to 119.876MB for 1255984-byte allocation
[dalvikvm-heap] Grow heap (frag case) to 121.163MB for 1255984-byte allocation
[dalvikvm-heap] Grow heap (frag case) to 122.449MB for 1255984-byte allocation
[dalvikvm-heap] Grow heap (frag case) to 123.735MB for 1255984-byte allocation
[dalvikvm-heap] Grow heap (frag case) to 125.022MB for 1255984-byte allocation
[dalvikvm-heap] Grow heap (frag case) to 153.372MB for 2674960-byte allocation
[dalvikvm-heap] Grow heap (frag case) to 154.683MB for 1197520-byte allocation
[skia] --- SkImageDecoder::Factory returned null
[skia] --- SkImageDecoder::Factory returned null
[skia] --- SkImageDecoder::Factory returned null
[skia] --- SkImageDecoder::Factory returned null
[skia] --- SkImageDecoder::Factory returned null
[Mono] GC_OLD_BRIDGE num-objects 534 num_hash_entries 58606 sccs size 22656
init 0.00ms df1 126.26ms sort 24.85ms dfs2 55.00ms setup-cb 4.80ms free-data
107.25ms links 103492/103492/661111/31 dfs passes 162632/126148
[Mono] GC_MINOR: (Nursery full) pause 143.61ms, total 143.69ms, bridge 241.43ms
promoted 48K major 5552K los 2026K
[skia] --- SkImageDecoder::Factory returned null
[skia] --- SkImageDecoder::Factory returned null
[skia] --- SkImageDecoder::Factory returned null
[skia] --- SkImageDecoder::Factory returned null
[Choreographer] Skipped 113 frames! The application may be doing too much work
on its main thread.
[dalvikvm-heap] Clamp target GC heap from 195.440MB to 192.000MB
[dalvikvm-heap] Clamp target GC heap from 197.988MB to 192.000MB
[dalvikvm-heap] Forcing collection of SoftReferences for 1243168-byte
allocation
[dalvikvm-heap] Clamp target GC heap from 197.988MB to 192.000MB
[dalvikvm-heap] Out of memory on a 1243168-byte allocation.
[Mono] DllImport attempting to load: '/system/lib/liblog.so'.
[Mono] DllImport loaded library '/system/lib/liblog.so'.
[Mono] DllImport searching in: '/system/lib/liblog.so'
('/system/lib/liblog.so').
[Mono] Searching for '__android_log_print'.
[Mono] Probing '__android_log_print'.
[Mono] Found as '__android_log_print'.
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] Java.Lang.OutOfMemoryError: Exception of type
'Java.Lang.OutOfMemoryError' was thrown.
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
[0x0000b] in
/Users/builder/data/lanes/1978/f98871a9/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61
[MonoDroid] at Android.Runtime.JNIEnv.CallStaticObjectMethod
(intptr,intptr,Android.Runtime.JValue*) [0x00064] in
/Users/builder/data/lanes/1978/f98871a9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1301
[MonoDroid] at Android.Graphics.Bitmap.CreateBitmap
(int,int,Android.Graphics.Bitmap/Config) [0x0006c] in
/Users/builder/data/lanes/1978/f98871a9/source/monodroid/src/Mono.Android/platforms/android-22/src/generated/Android.Graphics.Bitmap.cs:715
[MonoDroid] at
Xamarin.Forms.Platform.Android.FrameRenderer/FrameDrawable.CreateBitmap
(bool,int,int)
[MonoDroid] at Xamarin.Forms.Platform.Android.FrameRenderer/FrameDrawable.Draw
(Android.Graphics.Canvas)
[MonoDroid] at
Android.Graphics.Drawables.Drawable.n_Draw_Landroid_graphics_Canvas_
(intptr,intptr,intptr) [0x00011] in
/Users/builder/data/lanes/1978/f98871a9/source/monodroid/src/Mono.Android/platforms/android-22/src/generated/Android.Graphics.Drawables.Drawable.cs:1382
[MonoDroid] at (wrapper dynamic-method)
object.6ccdb139-34a6-48bc-b837-20ec9f34f393 (intptr,intptr,intptr)
[MonoDroid] --- End of managed exception stack trace ---
[MonoDroid] java.lang.OutOfMemoryError
[MonoDroid] at android.graphics.Bitmap.nativeCreate(Native Method)
[MonoDroid] at android.graphics.Bitmap.createBitmap(Bitmap.java:809)
[MonoDroid] at android.graphics.Bitmap.createBitmap(Bitmap.java:786)
[MonoDroid] at android.graphics.Bitmap.createBitmap(Bitmap.java:753)
[MonoDroid] at
md5530bd51e982e6e7b340b73e88efe666e.FrameRenderer_FrameDrawable.n_draw(Native
Method)
[MonoDroid] at
md5530bd51e982e6e7b340b73e88efe666e.FrameRenderer_FrameDrawable.draw(FrameRenderer_FrameDrawable.java:49)
[MonoDroid] at android.view.View.draw(View.java:14450)
[MonoDroid] at android.view.View.getDisplayList(View.java:13362)
[MonoDroid] at android.view.View.getDisplayList(View.java:13404)
[MonoDroid] at android.view.View.draw(View.java:14182)
[MonoDroid] at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
[MonoDroid] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
[MonoDroid] at android.view.View.getDisplayList(View.java:13357)
[MonoDroid] at android.view.View.getDisplayList(View.java:13404)
[MonoDroid] at android.view.View.draw(View.java:14182)
[MonoDroid] at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
[MonoDroid] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
[MonoDroid] at android.view.View.getDisplayList(View.java:13357)
[MonoDroid] at android.view.View.getDisplayList(View.java:13404)
[MonoDroid] at android.view.View.draw(View.java:14182)
[MonoDroid] at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
[MonoDroid] at android.widget.ListView.drawChild(ListView.java:3363)
[MonoDroid] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
[MonoDroid] at
android.widget.AbsListView.dispatchDraw(AbsListView.java:2458)
[MonoDroid] at android.widget.ListView.dispatchDraw(ListView.java:3358)
[MonoDroid] at android.view.View.draw(View.java:14468)
[MonoDroid] at android.widget.AbsListView.draw(AbsListView.java:3817)
[MonoDroid] at android.view.View.getDisplayList(View.java:13362)
[MonoDroid] at android.view.View.getDisplayList(View.java:13404)
[MonoDroid] at android.view.View.draw(View.java:14182)
[MonoDroid] at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
[MonoDroid] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
[MonoDroid] at android.view.View.draw(View.java:14468)
[MonoDroid] at android.view.View.getDisplayList(View.java:13362)
[MonoDroid] at android.view.View.getDisplayList(View.java:13404)
[MonoDroid] at android.view.View.draw(View.java:14182)
[MonoDroid] at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
[MonoDroid] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
[MonoDroid] at android.view.View.getDisplayList(View.java:13357)
[MonoDroid] at android.view.View.getDisplayList(View.java:13404)
[MonoDroid] at android.view.View.draw(View.java:14182)
[MonoDroid] at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
[MonoDroid] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
[MonoDroid] at android.view.View.draw(View.java:14468)
[MonoDroid] at android.view.View.getDisplayList(View.java:13362)
[MonoDroid] at android.view.View.getDisplayList(View.java:13404)
[MonoDroid] at android.view.View.draw(View.java:14182)
[MonoDroid] at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
[MonoDroid] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
[MonoDroid] at android.view.View.getDisplayList(View.java:13357)
[MonoDroid] at android.view.View.getDisplayList(View.java:13404)
[MonoDroid] at android.view.View.draw(View.java:14182)
[MonoDroid] at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
[MonoDroid] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
[MonoDroid] at android.view.View.getDisplayList(View.java:13357)
[MonoDroid] at android.view.View.getDisplayList(View.java:13404)
[MonoDroid] at android.view.View.draw(View.java:14182)
[MonoDroid] at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
[MonoDroid] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
[MonoDroid] at android.view.View.draw(View.java:14468)
It works perfect on iOS but on android it throws exception.
Mac OSX = 10.10.4
Xamarin Studio:
5.9.5
Solution Applied:
Increased Heap Size for Android to 2G but still facing this issue as heap size
is increased but app size is increasing continuously and crashed.
Note: I am not using or decoding any kind of images. (In many solutions it is
suggested you are using big size bitmaps so exception is thrown at decoding)