Reputation: 87
I am using Picasso to load 5 images, first thing first, I am resizing my image to match my screen width, which am also using as my height to have a square imageview, then am calling centercrop to make it look realistic and also removing the Alpha channel but even after all this my memory hikes to 85mb, the images are being downloaded from a server, below is the code am using
Picasso.with(context)
.load(sale.getImage())
.config(Bitmap.Config.RGB_565)
.centerCrop()
.resize((int) Utils.convertDpToPixel((int) Utils.getScreenWidth(context)), (int) Utils.convertDpToPixel((int) Utils.getScreenWidth(context)))
.into(viewHolder.img_image, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError() {
viewHolder.img_image.setVisibility(View.GONE);
viewHolder.img_image.destroyDrawingCache();
}
});
}
Here is an image showing the memory usage
One other thing I have noticed is Picasso does not clear memory after usage, sometimes it shows am using 20mb but when I call the GC
from Android Studio memory falls to about 8mb is there anything I need to do about this?
Upvotes: 1
Views: 301
Reputation: 11058
You are calling GC
and memory falls into minimum value? This says that there is no strong references to used bitmaps. Everything is OK.
Large memory usage happens due to decoding large images into bitmaps. Bitmap format is pretty heavy. There is nothing to do about this. I recommend you to lower resolution of the resulting images.
Upvotes: 2