I'm trying to trace memory leaks in my app. I have an Activity
in which I can switch between 7 Fragment
s. I'm instantiating the Fragment
s in the Activity
's onCreate()
and using the same instances when switching between them.
I'm using Picasso to load any images in the Fragment
s. As I switch between the Fragment
s, the memory allocation keeps increasing and even on finishing the Activity
, the memory is not freed.
I've used MAT to analyze the heap dump and it seems it's the Bitmap
s that aren't being freed.
I understand that I have a leak in the Activity
that contains the Fragment
s but since the the memory isn't being freed even after exiting the Activity
, I guess I'm also holding onto the Activity
also.
Since I haven't been able to use MAT in a beneficent way to identify the leaks (neither figure out where I'm holding onto the Activity
), I'd appreciate if someone could help me out.