React-native: Fatal Exception: java.lang.OutOfMemoryError

Created on 4 Apr 2016  路  3Comments  路  Source: facebook/react-native

My Android app is using React Native 0.22.0, developed on Mac. Everything is fine on development. After releasing today, I got crash reports from Crashlytics.

Report is

Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 23103292 byte allocation with 13011316 free bytes and 12MB until OOM
       at dalvik.system.VMRuntime.newNonMovableArray(VMRuntime.java)
       at android.graphics.Bitmap.nativeCreate(Bitmap.java)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:942)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:913)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:880)
       at com.facebook.imagepipeline.memory.BitmapPool.alloc(BitmapPool.java:55)
       at com.facebook.imagepipeline.memory.BitmapPool.alloc(BitmapPool.java:30)
       at com.facebook.imagepipeline.memory.BasePool.get(BasePool.java:259)
       at com.facebook.imagepipeline.platform.ArtDecoder.decodeStaticImageFromStream(ArtDecoder.java:137)
       at com.facebook.imagepipeline.platform.ArtDecoder.decodeFromEncodedImage(ArtDecoder.java:81)
       at com.facebook.imagepipeline.decoder.ImageDecoder.decodeStaticImage(ImageDecoder.java:127)
       at com.facebook.imagepipeline.decoder.ImageDecoder.decodeImage(ImageDecoder.java:94)
       at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.doDecode(DecodeProducer.java:188)
       at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.access$200(DecodeProducer.java:96)
       at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder$1.run(DecodeProducer.java:128)
       at com.facebook.imagepipeline.producers.JobScheduler.doJob(JobScheduler.java:207)
       at com.facebook.imagepipeline.producers.JobScheduler.access$000(JobScheduler.java:27)
       at com.facebook.imagepipeline.producers.JobScheduler$1.run(JobScheduler.java:78)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
       at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:43)
       at java.lang.Thread.run(Thread.java:818)

About 50% users face this issue. Really need to be fixed.
screen shot 2016-04-05 at 3 55 46 am
screen shot 2016-04-05 at 3 56 04 am

Locked

Most helpful comment

android/app/src/main/AndroidManifest.xml

<application
  android:largeHeap="true"

Adding largeHeap seems fix it

All 3 comments

The device is running out of memory, in the first case it is trying to allocate 22mb for a bitmap where there is only 12mb available. Do you know how much memory your app was allocating until that crash ? because it may be a memory leaking issue

I haven't noticed anything alarming in the apps I have deployed on Android to the Play Store recently. Could you provide more background here? I believe this is a subject to proper profiling so that we can get an idea what's going on here.

android/app/src/main/AndroidManifest.xml

<application
  android:largeHeap="true"

Adding largeHeap seems fix it

Was this page helpful?
0 / 5 - 0 ratings