Created
January 10, 2017 16:33
-
-
Save logcat/8aeca0ee81af6fb0dc10bb0d58940007 to your computer and use it in GitHub Desktop.
android dump heap with adb help
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heap_dump_location='/data/local/tmp/tmp.hprof' | |
dump_heap() { | |
adb shell rm $heap_dump_location | |
pid=`adb shell ps | grep 'com.example.packagename' | grep -v 'packagename\.' | cut -c10-15` | |
adb shell am dumpheap $pid $heap_dump_location | |
echo "Heap dump started, we have no idea when it's done, so take a look at logs, and when is done use pull_heap_dump" | |
} | |
pull_heap_dump() { | |
adb pull $heap_dump_location ~/Desktop/$1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment