-
Notifications
You must be signed in to change notification settings - Fork 3.8k
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Out Of Memory Error decoding image on Lollipop #468
Comments
It is normal that there are no OOMs pre to Lollipop. It would be useful to know some numbers here: how many bitmaps do you display simultaneously ? And what are their sizes ? |
Hmm that's interesting, why would we expect OOM crashes on Lollipop and not on older os versions? We display our images in a viewpager, displaying a single image at a time. We will cache the previous 2 and next 2 views in the pager, for a total of 5 images. If you click on one of the views, we'll take you to a full screen viewpager with zoomable drawee views. It's the same thing here, displaying an image 1 at a time caching 2 in either direction. The images are just a few hundred kb in size. An example of 5 images that might be loaded are available at these urls:
|
On pre-Lollipop androids we store images off the java heap. Google killed that trick in Lollipop. Each of those images seem to be ~ 1024 x 700 pixels, which gives us 2.7MB per Bitmap. There should be enough place to store a few of those. What is the max heap size ? You can try making Bitmap cache smaller: http://frescolib.org/docs/configure-image-pipeline.html#configuring-the-memory-caches |
Thanks for your help and the prompt responses @michalgr. Sorry for the false alarm, but we actually pinned the issue down to our handling of the view pager, we just got a bit concerned when we were seeing it happen in production. I'll go ahead and close this issue. |
It have the some problem.My app will display a lot of images in different activity using Fresco.It works well on pre Android L devices,but crash on Lollipop.My images are very small(10-20K).I guess Fresco won't recycle the memory on Lollipop . |
@LinJZong: please open separate issue and include more details, like what are the dimensions of decoded Bitmaps and what container view do you use (ListView, ScrollView, RecyclerView etc). |
Hello,
We recently released Fresco in our production app and we're seeing a lot of crashes from OutOfMemory errors, looking at the stacktrace it looks like it's happening during decoding the image. The interesting thing is that all of these crashes are only happening on Lollipop, none of them happen on pre Android L devices. We are using a memoryTrimmableRegistry, and calling the trimMemory functions when we receive an onMemoryTrim() call from our activity.
This seems to be happening on pages where users are interacting with a view pager of images. The views we are using in the pager are either just a SimpleDraweeView, or a ZoomableDraweeView which is based on the provided sample. When we initially implemented this we were seeing TooManyBitmaps exceptions and it looked like it was because the pager adapter wasn't releasing the images even though they were removed from the container. To solve this we added in this bit of code in our PagerAdapter.destroyItem() override, does it look like this could somehow cause any issues?
Do you have any idea what could be causing this, is there any more information we can provide?
The stacktrace is included below
The text was updated successfully, but these errors were encountered: