I working on a android project like a instagram. There are a lot of images, datas etc. in the project. I used Glide library for set images in ImageView. So if I open 10 profile pages in succession I get out-of-memory error like:
java.lang.OutOfMemoryError: Failed to allocate a 44236812 byte allocation with 16777216 free bytes and 32MB until OOM
I tried to setFlag to intent :
setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
and tried add Manifest.xml :
android:largeHeap="true"
android:hardwareAccelerated="false"
and tried add in Glide functions one by one :
.apply(new RequestOptions().format(DecodeFormat.PREFER_RGB_565)
.skipMemoryCache( true )
.diskCacheStrategy( DiskCacheStrategy.NONE ) and DiskCacheStrategy.DATA
But none of them couldnt fix my error.
Also this screenshot is my Profiler output:
I test in Profiler memory can be up to 600 mb and than application will dump.
How can I fix that? I need someone's help.