Why does heap memory increase when re-launching an activity?

前端 未结 5 1087
悲哀的现实
悲哀的现实 2020-12-05 16:00

This question concerns memory in Android.

My method:

I have two activites, A and B. From A, I launch B like this:

Intent i =         


        
5条回答
  •  半阙折子戏
    2020-12-05 16:09

    Seems that you have a memory leak within that activity.

    Probably you are leaking the context (the activity in this case). So ensure that all the references to the context are being cleaned when you call the onDestroy method in the activity. More details here.

    Also take a look to possible content observers not being unregistered when you finish the activity.

提交回复
热议问题