I've a demo app in which I'm using Xamarin.Mobile
to allow user to pick image.
I copy image picked by user in App's local folder & return copied image's path.
This path is used to display image in ListView.
When the user selects image from SD card, after picking just 2-3 images, app crashes. Visual Studio's Output window shows Clamp target GC Heap......, OutOfMemoryError etc errors.
When the user selects image from internal storage, app works fine. Also app works fine on iOS & Win 10.
What should I do so that app doesn't crash.
Following are some details of o/p window:
01-21 10:43:14.105 I/art ( 9508): Forcing collection of SoftReferences for 19MB allocation
01-21 10:43:14.142 I/art ( 9508): Clamp target GC heap from 97MB to 96MB
01-21 10:43:14.142 I/art ( 9508): Alloc concurrent mark sweep GC freed 14(528B) AllocSpace objects, 0(0B) LOS objects, 14% free, 81MB/96MB, paused 1.088ms total 51.381ms
01-21 10:43:14.143 I/art ( 9508): WaitForGcToComplete blocked for 37.689ms for cause Alloc
01-21 10:43:14.148 E/art ( 9508): Throwing OutOfMemoryError "Failed to allocate a 20155404 byte allocation with 14688596 free bytes and 14MB until OOM"
01-21 10:43:14.154 D/skia ( 9508): --- decoder->decode returned false
01-21 10:43:14.175 I/art ( 9508): Clamp target GC heap from 97MB to 96MB
01-21 10:43:14.175 I/art ( 9508): Alloc concurrent mark sweep GC freed 6(336B) AllocSpace objects, 1(16KB) LOS objects, 14% free, 81MB/96MB, paused 937us total 31.486ms
01-21 10:43:14.175 E/art ( 9508): Throwing OutOfMemoryError "Failed to allocate a 20155404 byte allocation with 14704864 free bytes and 14MB until OOM"
01-21 10:43:14.186 I/art ( 9508): Alloc sticky concurrent mark sweep GC freed 5(352B) AllocSpace objects, 0(0B) LOS objects, 8% free, 81MB/89MB, paused 1.471ms total 9.601ms
01-21 10:43:14.205 I/art ( 9508): Clamp target GC heap from 97MB to 96MB
01-21 10:43:14.205 I/art ( 9508): Alloc partial concurrent mark sweep GC freed 9(288B) AllocSpace objects, 1(16KB) LOS objects, 14% free, 81MB/96MB, paused 1.410ms total 18.340ms
01-21 10:43:14.270 I/art ( 9508): Clamp target GC heap from 97MB to 96MB
01-21 10:43:14.270 I/art ( 9508): Alloc concurrent mark sweep GC freed 8(288B) AllocSpace objects, 0(0B) LOS objects, 14% free, 81MB/96MB, paused 4.848ms total 61.334ms
01-21 10:43:14.270 I/art ( 9508): Forcing collection of SoftReferences for 19MB allocation
01-21 10:43:14.322 I/art ( 9508): Clamp target GC heap from 97MB to 96MB
01-21 10:43:14.322 I/art ( 9508): Alloc concurrent mark sweep GC freed 8(448B) AllocSpace objects, 0(0B) LOS objects, 14% free, 81MB/96MB, paused 3.694ms total 51.043ms
01-21 10:43:14.322 E/art ( 9508): Throwing OutOfMemoryError "Failed to allocate a 20155404 byte allocation with 14721628 free bytes and 14MB until OOM"
01-21 10:43:14.322 D/skia ( 9508): --- decoder->decode returned false
An unhandled exception occured.