-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Add a pre-filling api for the BitmapPool #93
Comments
Implemented here: 5207906 |
If I'll profile it with images 50x50 and loading images from network one by one they extend the memory. Seems like prefill does nothing. The memory monitor behaves the same way. |
Maybe your sizes aren't quite right or you're not prefilling with the correct format? You can turn on verbose logging using:
Doing so will log the contents of the BitmapPool with each request for a Bitmap as well as whether or not a Bitmap was available for the requested width/height/config. If you're using a device before KitKat, keep in mind that the width, height, and config have to match exactly for you to be able to re-use a Bitmap. |
I think, this is because of the #333 bug |
The BitmapPool api will have to expand a bit:
int getCurrentSize();
int getMaxSize();
Then we could add an api to Glide:
void prefillBitmapPool(TargetSize...);
Where TargetSize is a simple immutable object:
public TargetSize(int width, int height, Bitmap.Config config, float fillPercentage) { }
Each call would make sure at least the given % of the bitmap pool was filled with bitmaps of the given width, height and config.
The allocations can usually be done in a tight loop, but we may want to add something like a time based check to break out of the loop early because occasionally the garbage collector seems to get into a degenerate state where it triggers a GC_FOR_ALLOC for each bitmap in the loop.
The text was updated successfully, but these errors were encountered: