开发者

Allocation Tracker: How to use it to detect memory leaks?

I have two activities: A and B. Starting in A, I go to activity B. Then I call finish() on B and get back to A. Every time I repeat this process allocated memory is increased by 0.1 MB.

So I want to find out what's causing this leak. I have tried to use the allocation tracker by tracking allocated memory during the process just mentioned. Then when I press "Get Allocations" I get a long list of allocations. My question is: How do I read that list in order to find out what's causing my leak?

I have tried to solve this by releasing all resources in the onDestroy method of activity B and that helped a little bit. And also, I'm not allocating new memory in the onResume method of ac开发者_如何转开发tivity A.

Just to show that I'm using allocation tracker correctly:

Allocation Tracker: How to use it to detect memory leaks?


You should checkout this video, it explains memory leak finding in details and is just great :)


I believe the Allocation Tracker is a log of items that have been allocated to memory (i.e. initialized). It is not a snapshot of items currently in memory. You need to look at the Heap for that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜