Xamarian.Forms Out of memory exception #83
Description
I'm having a problem with the signature pad on android under forms. After around 35 uses the app crashes with an OOM exception inside android. This was tested on a J3 phone with version 2.1.1 With version 1.5.1 this problem doesn't happen, and I can repeat the calling of the page as many times as I like. I've attached a demo solution that exhibits this problem.
TestSignaturePad.zip
07-10 16:40:23.766 I/MonoDroid( 6196): UNHANDLED EXCEPTION:
07-10 16:40:23.886 I/MonoDroid( 6196): Java.Lang.OutOfMemoryError: Failed to allocate a 2851212 byte allocation with 632184 free bytes and 617KB until OOM
07-10 16:40:23.886 I/MonoDroid( 6196): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0
07-10 16:40:23.886 I/MonoDroid( 6196): at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in :0
07-10 16:40:23.886 I/MonoDroid( 6196): at Java.Interop.JniPeerMembers+JniStaticMethods.InvokeObjectMethod (System.String encodedMember, Java.Interop.JniArgumentValue* parameters) [0x00018] in :0
07-10 16:40:23.886 I/MonoDroid( 6196): at Android.Graphics.Bitmap.CreateBitmap (System.Int32 width, System.Int32 height, Android.Graphics.Bitmap+Config config) [0x0005a] in :0
07-10 16:40:23.886 I/MonoDroid( 6196): at Xamarin.Controls.InkPresenter.CreateBufferImage () [0x00047] in <1c8da6cdedc6484799a7f1284def41ac>:0
07-10 16:40:23.886 I/MonoDroid( 6196): at Xamarin.Controls.InkPresenter.OnDraw (Android.Graphics.Canvas canvas) [0x00044] in <1c8da6cdedc6484799a7f1284def41ac>:0
07-10 16:40:23.886 I/MonoDroid( 6196): at Android.Views.View.n_OnDraw_Landroid_graphics_Canvas_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_canvas) [0x0000f] in :0
07-10 16:40:23.886 I/MonoDroid( 6196): at (wrapper dynamic-method) System.Object:05e98750-69cc-4ddd-bc25-2dbaafb6a9ad (intptr,intptr,intptr)
07-10 16:40:23.886 I/MonoDroid( 6196): --- End of managed Java.Lang.OutOfMemoryError stack trace ---