Skip to content
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

Bitmap limit is hardcoded to 384 #1980

Closed
EMIN3M1986 opened this issue Dec 2, 2017 · 17 comments
Closed

Bitmap limit is hardcoded to 384 #1980

EMIN3M1986 opened this issue Dec 2, 2017 · 17 comments

Comments

@EMIN3M1986
Copy link

EMIN3M1986 commented Dec 2, 2017

Hi. I'm using fresco to load a lot of stickers.
Until version number 14 there is no any problem. In 14 and above always on pre lollipop version this exception happened and app crashed.
I set maximum number of cache in fresco configuration.
com.facebook.imagepipeline.common.TooManyBitmapsException

@foghina
Copy link
Contributor

foghina commented Dec 7, 2017

Are the stickers animated (gif / webp)?

If not, it's probably just a matter of either increasing the memory cache size (which you can do when configuring the pipeline), or more aggressively recycling DraweeViews. What are you using to display stickers, ScrollView or List/RecyclerView?

@foghina foghina added the needs-details This issue or PR is currently not actionable as it misses details (e.g. for reproducing the problem) label Dec 7, 2017
@EMIN3M1986
Copy link
Author

Yes I use some animated (gif) and png Stickers in RecyclerView.
I set cache on maximum.

@EMIN3M1986
Copy link
Author

EMIN3M1986 commented Dec 23, 2017

This is the Error Message (version 1.7.1) :

`Android: 4.2.2
Android Build: ME173X_WW_user_4.2.4.04152_20140714
Manufacturer: asus
Model: ME173X
Thread: FrescoDecodeExecutor-3-9400
CrashReporter Key: 4a7089c9-30d0-4240-b0c1-91edd3d2d4b6
Start Date: 2017-12-23T04:51:29.006Z
Date: 2017-12-23T04:52:17.563Z

com.facebook.imagepipeline.common.TooManyBitmapsException: Attempted to pin a bitmap of size 65536 bytes. The current pool count is 384, the current pool size is 45220368 bytes. The current pool max count is 384, the current pool max size is 100663296 bytes.
at com.facebook.imagepipeline.platform.DalvikPurgeableDecoder.pinBitmap(DalvikPurgeableDecoder.java:178)
at com.facebook.imagepipeline.platform.KitKatPurgeableDecoder.pinBitmap(KitKatPurgeableDecoder.java:30)
at com.facebook.imagepipeline.platform.DalvikPurgeableDecoder.decodeJPEGFromEncodedImage(DalvikPurgeableDecoder.java:95)
at com.facebook.imagepipeline.platform.KitKatPurgeableDecoder.decodeJPEGFromEncodedImage(KitKatPurgeableDecoder.java:30)
at com.facebook.imagepipeline.bitmaps.HoneycombBitmapFactory.createBitmapInternal(HoneycombBitmapFactory.java:64)
at com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory.createBitmap(PlatformBitmapFactory.java:76)
at com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory.createBitmap(PlatformBitmapFactory.java:43)
at com.facebook.fresco.animation.bitmap.preparation.DefaultBitmapFramePreparer$FrameDecodeRunnable.prepareFrameAndCache(DefaultBitmapFramePreparer.java:144)
at com.facebook.fresco.animation.bitmap.preparation.DefaultBitmapFramePreparer$FrameDecodeRunnable.prepareFrameAndCache(DefaultBitmapFramePreparer.java:162)
at com.facebook.fresco.animation.bitmap.preparation.DefaultBitmapFramePreparer$FrameDecodeRunnable.run(DefaultBitmapFramePreparer.java:112)
at com.facebook.common.executors.ConstrainedExecutorService$Worker.run(ConstrainedExecutorService.java:177)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:53)
at java.lang.Thread.run(Thread.java:838)`

@EMIN3M1986
Copy link
Author

EMIN3M1986 commented Jan 3, 2018

Nobody ?
I still use version 1.3.0 because of this bug.

@EMIN3M1986
Copy link
Author

It seems nobody knows the issue and I obligate to use glide instead.

@foghina
Copy link
Contributor

foghina commented Jan 17, 2018

We have this issue internally to some degree as well. In our case the fix was to use forceStaticImage in the decode options so that we only show the first frame of the gif in the RecyclerView. You can then implement a tap-to-play feature. Showing many GIFs in a grid/list view is going to be hard with any image library.

You can also look into using videos instead.

In 14 and above

Do you mean version 0.14? That is very old. Have you tried with something more recent, like 1.7.1?

@EMIN3M1986
Copy link
Author

EMIN3M1986 commented Jan 21, 2018

I remove all gifs and load just png. Even in version 1.8.0 there is this problem too.
Why are you set limitation ?

@foghina
Copy link
Contributor

foghina commented Jan 22, 2018

So I think in v1.4.0 (is this what you're using?) we switched from having a separate memory cache for GIF frames to using the main one. This is good generally as it reduces the overall memory footprint (and OOMs) of Fresco by evicting other bitmaps in favor of animation frames, but it does also lead to this exception.

@oprisnik since you made this change, do you know if there is a way around this exception? Perhaps increasing the default bitmap pool size? Or configuring the frame prefetching differently?

@oprisnik
Copy link
Contributor

@robinxb
Copy link

robinxb commented Jan 29, 2018

We are facing the same issue that reaching the 384 limitation. Is there any solution we can bypass this exception ?

@wangbin0802
Copy link

I don't know why the official still not solve this problem? This will cause lots of crash in my app.

@tgithubc
Copy link

@robinxb
you can see #213
There has my answer in the article, I hope I can help you.

@oprisnik oprisnik self-assigned this May 24, 2018
@oprisnik oprisnik changed the title com.facebook.imagepipeline.common.TooManyBitmapsException Bitmap limit is hardcoded to 384 May 24, 2018
@oprisnik
Copy link
Contributor

We should make this configurable.

@oprisnik oprisnik added enhancement starter-task help wanted and removed needs-details This issue or PR is currently not actionable as it misses details (e.g. for reproducing the problem) labels May 24, 2018
@defHLT
Copy link
Contributor

defHLT commented Jul 2, 2018

This is now an option 3ccf021

@defHLT defHLT closed this as completed Jul 2, 2018
@defHLT defHLT assigned defHLT and unassigned oprisnik Jul 2, 2018
@huopochuan
Copy link

Are the stickers animated (gif / webp)?

If not, it's probably just a matter of either increasing the memory cache size (which you can do when configuring the pipeline), or more aggressively recycling DraweeViews. What are you using to display stickers, ScrollView or List/RecyclerView?

use RecyclerView

@huopochuan
Copy link

if bitmap over 384, it do not recycle/release?

@defHLT
Copy link
Contributor

defHLT commented Sep 13, 2018

@huopochuan Sorry, not sure I understand your question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants