问题描述
由于已经详细说明许多有益的网站,人们分析的Android应用程序的内存使用的方法是执行杀人-10 [PID]触发HPROF转储。这似乎工作在某些设备上,以及logcat中通常包含这样的:
As has been detailed by many helpful sites, one way to analyze memory usage of Android apps is to execute a "kill -10 [PID]" to trigger an HPROF dump. This seems to work on some devices, and the logcat normally contains something like this:
I/dalvikvm(32170): threadid=3: reacting to signal 10
I/dalvikvm(32170): SIGUSR1 forcing GC and HPROF dump
I/dalvikvm(32170): hprof: dumping VM heap to "/data/misc/heap-dump-tm1302633572-pid32170.hprof-hptemp".
I/dalvikvm(32170): hprof: dumping heap strings to "/data/misc/heap-dump-tm1302633572- pid32170.hprof".
I/dalvikvm(32170): hprof: heap dump completed, temp file removed
然而,在其他设备上,执行杀-10的结果是:
However, on other devices, executing the "kill -10" results in this:
I/dalvikvm( 5687): threadid=4: reacting to signal 10
I/dalvikvm( 5687): SIGUSR1 forcing GC (no HPROF)
所有我想这对设备的根和我做了肯定和chmod /数据/杂项777我执行杀人-10后没有得到任何错误消息。
All the devices I'm trying this on are rooted and I've made sure to chmod /data/misc to 777. I don't get any error messages after executing "kill -10".
在情况下,它是有帮助的,这里有在那里我得到一个HPROF转储设备:HTC ACE(Desire HD的),HTC G1,HTC的Nexus One(T-Mobile)的
In case it's helpful, here are the devices where I do get an HPROF dump:HTC ACE (Desire HD), HTC G1, HTC Nexus One (T-Mobile)
和这里的设备,我没有得到一个HPROF转储:歌Nexus S,Droid的,Droid X的,的Nexus One(AT& T公司)
And here are the devices where I do NOT get an HPROF dump:Nexus S, Droid, Droid X, Nexus One (AT&T)
我为什么不能得到某些设备的HPROF转储和有什么我可以做的,让我拿到垃圾场?
Why can't I get an HPROF dump from certain devices and is there anything I can do to allow me to get the dumps?
推荐答案
使用DDMS。点击HPROF转储文件工具栏图标 - 它看起来像一个半完全可以用一个向下的箭头。工作就像一个魅力时,我试了一下刚才一台Nexus S上。
Use DDMS. Click on the "Dump HPROF File" toolbar icon -- it looks like a half-full can with a downward-pointing arrow. Worked like a charm when I tried it just now on a Nexus S.
这篇关于为什么我不能得到某些设备的HPROF转储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!