Following single activity with multiple fragment approach(MVC design pattern), where i can see the app consumes around 200 MB in the android profiler. I have resolve the most of the leaks present in the application but the native & graphics memory is consuming much of the memory as mentioned in the attached image.
My main activity consist of 2 fragments with background images for each fragment.Once main activity launched the memory consumption is around 95 MB(native ~60MB & graphics ~30MB) but once i started opening other fragments for example setting screen(new fragment),these consumption is getting increased suddenly by around 50 MB for the first time & from the next consecutive launch of this setting fragment causes ~10 MB of hike.
I have taken the heap dump from the android profiler where majority of the memory consumed by Bitmap(~40 MB),BitmapDrawable(~25Mb) attached pic 2.
I have tried multiple approaches like:
- Loading image dynamically in the code by performing some scaling - image resolution affected
- Clearing the object once fragment is destroyed - No improvement
- Removing unnecessary gradle libs - No improvement
- Resolve leaks present in the app - little improvement(~15 MB reduced)
Once i remove all the opened fragments present on top of the activity why these native & graphics memory is not getting release & coming back to initial memory consumption(~95 MB).