Android app consumes too much memory in native heap - Android profiler

810 views Asked by At

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.enter image description here

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 2enter image description here.

I have tried multiple approaches like:

  1. Loading image dynamically in the code by performing some scaling - image resolution affected
  2. Clearing the object once fragment is destroyed - No improvement
  3. Removing unnecessary gradle libs - No improvement
  4. 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).

0

There are 0 answers