Reputation: 2117
I'm using the glide library in my app for displaying bitmap (from asset and from url). It works well but I get somme Out of memomy issues as I'm displaying a lot of images in each activities. I see I can use the clearMemory() from BitmapPool, but I have no clue how to call it..
Is someone know how to call it?
Thanks
Upvotes: 4
Views: 5053
Reputation: 7387
You can use clearMemory()
or trimMemory()
to clear both Glide's memory cache and bitmap pool:
Glide.get(context).clearMemory()
// or:
Glide.get(context).trimMemory(ComponentCallbacks2.TRIM_MEMORY_MODERATE);
That said, you shouldn't need to do either. Two things to check:
override()
API on your request. Doing so in conjunction with a Transformation like fitCenter
will help reduce the memory used per image.Upvotes: 7