[英]My App is taking 250mb memory on my device. When I do a heap dump and analyze it. it says the heap size around 7mb
Is there another memory which is being used that doesn't show on a heap dump? 是否有另一个正在使用的内存未在堆转储中显示? I am using Memory Analyzer on Eclipse. 我在Eclipse上使用Memory Analyzer。 First I dump the heap with DDMS and Memory Analyzer picks. 首先,我使用DDMS和Memory Analyzer选择转储堆。 it only shows that the size of the heap is 7mb and the histogram is basically telling me everything is fine. 它只显示堆的大小是7mb,直方图基本上告诉我一切都很好。 However, I have downloaded several memory monitoring apps on my device and they all say my app is taking 250mb and it keeps climbing. 但是,我已经在我的设备上下载了几个内存监控应用程序,他们都说我的应用程序占用250mb并且它一直在攀爬。
How else can I try to find out why its taking so much memory? 我怎么能试着找出为什么它会占用这么多记忆呢?
Memory measuring apps are not worth very much, as, to quote Dianne Hackborn : 内存测量应用程序并不值得,因为引用Dianne Hackborn :
Note that memory usage on modern operating systems like Linux is an extremely complicated and difficult to understand area. 请注意,像Linux这样的现代操作系统上的内存使用是一个非常复杂且难以理解的领域。 In fact the chances of you actually correctly interpreting whatever numbers you get is extremely low. 事实上,你实际正确地解释你得到的任何数字的可能性非常低。
That being said, you are welcome to use the techniques outlined in her answer to try to get a better handle on what those tools are claiming and whether it is really a problem. 话虽如此,欢迎您使用她的答案中概述的技术,试图更好地处理这些工具声称的内容以及它是否真的是一个问题。
Also: 也:
If you have more than one process, bear in mind that DDMS' heap dump is for a single process 如果您有多个进程,请记住DDMS的堆转储是针对单个进程的
If you are doing native development using the NDK, NDK allocations are not part of the managed heap and therefore are not included in the heap dump 如果使用NDK进行本机开发,则NDK分配不是托管堆的一部分,因此不包含在堆转储中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.