facebook / fresco

An Android library for managing images and the memory they use.
https://frescolib.org/
MIT License
17.07k stars 3.75k forks source link

Gif animation is very slow and crashes with OOM in 1.5.0 #1914

Open kraghu opened 7 years ago

kraghu commented 7 years ago

We use GitHub Issues for bugs.

If you have a non-bug question, please ask on Stack Overflow: http://stackoverflow.com/questions/tagged/fresco

--- Please use this template, and delete everything above this line before submitting your issue ---

Description

[FILL THIS OUT: Explain what you did, what you expected to happen, and what actually happens.] We have a photo shop created gif files and it always crashes in our app running on older devices

Reproduction

[FILL THIS OUT: How can we reproduce the bug? Provide URLs to relevant images if possible, or a sample project.] Run on android device > 5.0 who got upgraded from older versions.

Solution

[OPTIONAL: Do you know what needs to be done to address this issue? Ideally, provide a pull request which fixes this issue.] I think the GC in those devices are very different . I have no idea how fresco internally does it

Additional Information

foghina commented 7 years ago

Hi @kraghu. Do you think you can provide these problematic GIFs, to help us debug? CC @oprisnik

kraghu commented 7 years ago

will update tomorrow .

xiaolongyuan commented 6 years ago

@kraghu

kraghu commented 6 years ago

9ca60e3e-ff3a-4365-9008-61c4bec1e154

This is loaded from the network. based on my observation this works fine in OS 25 n 26 . Both are latest OS . But if you try to run on devices like <25 . it crashes all over. The glide happens to handle this well.

oprisnik commented 6 years ago

What's the crash that you're seeing?

kraghu commented 6 years ago

OOM

ksegla commented 6 years ago

User of react-native here. I think my issue (https://github.com/facebook/react-native/issues/16529) may be linked to this: Got a crash report from Google Play pointing to fresco as well. In my case, it is Webviews loading GIFs. Flickers after a while, sometimes crashes. Used to work fine 1-2 months ago (and while on React Native 0.43.2). Still works on fine on 5.0 and under systems. The issue is on Android 7.0. Memory analysis with Android Device Monitor indicates OOM at some point too. Below, the report from Google Play:

java.lang.RuntimeException: at android.view.DisplayListCanvas.throwIfCannotDraw (DisplayListCanvas.java:260) at android.graphics.Canvas.drawBitmap (Canvas.java:1420) at android.graphics.drawable.BitmapDrawable.draw (BitmapDrawable.java:545) at com.facebook.drawee.drawable.RoundedBitmapDrawable.draw (RoundedBitmapDrawable.java:229) at com.facebook.drawee.drawable.ForwardingDrawable.draw (ForwardingDrawable.java:147) at com.facebook.drawee.drawable.ForwardingDrawable.draw (ForwardingDrawable.java:147) at com.facebook.drawee.drawable.ScaleTypeDrawable.draw (ScaleTypeDrawable.java:126) at com.facebook.drawee.drawable.FadeDrawable.drawDrawableWithAlpha (FadeDrawable.java:306) at com.facebook.drawee.drawable.FadeDrawable.draw (FadeDrawable.java:293) at com.facebook.drawee.drawable.ForwardingDrawable.draw (ForwardingDrawable.java:147) at com.facebook.drawee.generic.RootDrawable.draw (RootDrawable.java:85) at android.widget.ImageView.onDraw (ImageView.java:1268) at android.view.View.draw (View.java:18394)

AikoKiko commented 5 years ago

There might be worth trying, if you have a backend of GIF images, you could start downloading firstly low-resolution images, and upon GridView download real GIF parallelly so that low-resolution thumbnails could be interchanged with real ones one to one