question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Report from Firebase ] BucketsBitmapPool.java line 54.

See original GitHub issue

I can’t reproduce this crash, but this is a report from Firebase.

Devices:

  1. Galaxy J3(2016) (20% )
  2. Vivo Y21 - (Vivo 40%)
  3. Vivo Y55s
  4. Huawei LISZT - (Huawei 40%)

OS: Android 5.1.1 (60%), Android 5.1 (40%)

Fresco Version: ‘com.facebook.fresco:fresco:2.0.0’ ‘com.facebook.fresco:animated-gif:2.0.0’ ‘com.facebook.fresco:imagepipeline-okhttp3:1.12.1’


Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 3467676 byte allocation with 2657936 free bytes and 2MB until OOM
       at dalvik.system.VMRuntime.newNonMovableArray(VMRuntime.java)
       at android.graphics.Bitmap.nativeCreate(Bitmap.java)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:842)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:812)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:779)
       at com.facebook.imagepipeline.memory.BucketsBitmapPool.alloc(BucketsBitmapPool.java:54)
       at com.facebook.imagepipeline.memory.BucketsBitmapPool.alloc(BucketsBitmapPool.java:29)
       at com.facebook.imagepipeline.memory.BasePool.get(BasePool.java:266)
       at com.facebook.imagepipeline.platform.DefaultDecoder.decodeFromStream(DefaultDecoder.java:217)
       at com.facebook.imagepipeline.platform.DefaultDecoder.decodeJPEGFromEncodedImageWithColorSpace(DefaultDecoder.java:155)
       at com.facebook.imagepipeline.decoder.DefaultImageDecoder.decodeJpeg(DefaultImageDecoder.java:181)
       at com.facebook.imagepipeline.decoder.DefaultImageDecoder$1.decode(DefaultImageDecoder.java:58)
       at com.facebook.imagepipeline.decoder.DefaultImageDecoder.decode(DefaultImageDecoder.java:121)
       at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.doDecode(DecodeProducer.java:281)
       at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.access$200(DecodeProducer.java:128)
       at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder$1.run(DecodeProducer.java:170)
       at com.facebook.imagepipeline.producers.JobScheduler.doJob(JobScheduler.java:202)
       at com.facebook.imagepipeline.producers.JobScheduler.access$000(JobScheduler.java:22)
       at com.facebook.imagepipeline.producers.JobScheduler$1.run(JobScheduler.java:73)
       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:51)
       at java.lang.Thread.run(Thread.java:831)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
kmrinmoy07commented, Oct 23, 2020
    ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
            .setDownsampleEnabled(true)
            .setResizeAndRotateEnabledForNetwork(true)
            .setBitmapsConfig(Bitmap.Config.RGB_565)
            .setMemoryTrimmableRegistry(frescoMemoryTrimmableRegistry)
            .build();
    Fresco.initialize(this, config);

Will this help?

Guys I have the same error. Can you tell me please where should I put this config? Which file? Will it help me?

You need to place this in your Application class, also you need to create a new class for the TrimmableRegistry. For example create a new class as -

     public class FrescoMemoryTrimmableRegistry implements MemoryTrimmableRegistry {

          private final List<MemoryTrimmable> trimmables = new LinkedList<>();

          @Override
           public void registerMemoryTrimmable(final MemoryTrimmable trimmable) {
              trimmables.add(trimmable);
           }

         @Override
          public void unregisterMemoryTrimmable(final MemoryTrimmable trimmable) {
             trimmables.remove(trimmable);
          }

         public synchronized void trim(final MemoryTrimType trimType) {
            for (MemoryTrimmable trimmable : trimmables) {
              trimmable.trim(trimType);
         }
     }

Then inside your Application class use it as

    private final FrescoMemoryTrimmableRegistry frescoMemoryTrimmableRegistry = new FrescoMemoryTrimmableRegistry();

After that use

    ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
        .setDownsampleEnabled(true)
        .setResizeAndRotateEnabledForNetwork(true)
        .setBitmapsConfig(Bitmap.Config.RGB_565)
        .setMemoryTrimmableRegistry(frescoMemoryTrimmableRegistry)
        .build();
   Fresco.initialize(this, config);
2reactions
kmrinmoy07commented, Jun 28, 2020
    ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
            .setDownsampleEnabled(true)
            .setResizeAndRotateEnabledForNetwork(true)
            .setBitmapsConfig(Bitmap.Config.RGB_565)
            .setMemoryTrimmableRegistry(frescoMemoryTrimmableRegistry)
            .build();
    Fresco.initialize(this, config);

Will this help?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ContextCompat ANR reports multiple times on firebase
I got a ANR report on firebase. Its count is increasing and I cannot figure out this since it does not mention anywhere...
Read more >
Facebook - Bountysource
We are facing OOM only on android 6 devices during image fetching from network. Stacktrace: Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found