Android: Detecting leaks with Eclipse Memory Analyzer

前端 未结 1 1095
借酒劲吻你
借酒劲吻你 2020-12-20 07:22

I have this problem Android: Screen orientation error + VM won't let us allocate x bytes so I decided to download Eclipse Memory Analyzer. I run it when my error is appe

1条回答
  •  死守一世寂寞
    2020-12-20 08:00

    On Android, I think it quite easy to leak an Activity context. So the most frequently way I used to find a memory leak, is to open an OQL tab, and input 'select * from instanceof android.app.Activity' . Then you could see how many Activity instances there, and you could tell whether there is a leak or not by your own judgement. Also you could right-click on one of the Activity instances, and click 'Path to GC'--> 'exclude all soft/weak/phantom references'. Then you could see the references to the Activity in chain. Good luck !

    0 讨论(0)
提交回复
热议问题