为什么我无法从某些设备获取 HPROF 转储?
正如许多有用网站所详细介绍的,分析 Android 应用程序内存使用情况的一种方法是执行“kill -10 [PID]”来触发 HPROF 转储。这似乎在某些设备上有效,并且 logcat 通常包含类似以下内容:
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
但是,在其他设备上,执行“kill -10”会导致以下结果:
I/dalvikvm( 5687): threadid=4: reacting to signal 10
I/dalvikvm( 5687): SIGUSR1 forcing GC (no HPROF)
我正在尝试执行此操作的所有设备都已扎根并且我已经制作了确保 chmod /data/misc 为 777。执行“kill -10”后我没有收到任何错误消息。
如果它有帮助,这里是我获得 HPROF 转储的设备: HTC ACE (Desire HD)、HTC G1、HTC Nexus One (T-Mobile)
以下是我没有获得 HPROF 转储的设备: Nexus S、Droid、Droid X、Nexus One (AT&T)
为什么我无法从某些设备获取 HPROF 转储,我可以采取什么措施来获取转储吗?
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
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)
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".
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)
And here are the devices where I do NOT get an HPROF dump:
Nexus S, Droid, Droid X, Nexus One (AT&T)
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用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.