Why can't I get an HPROF dump from certain devices?
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开发者_JAVA百科: 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?
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.
精彩评论