I am trying to get an .hprof file using the 'dump java heap' button in Android Studio memory monitor, but for some reason no .hprof file is generated. Does anybody know why? Allocation Tracking works okay.
Android Studio 2.1.2 'Dump Java Heap' Not working (Mac OS El Capitan)
Asked Answered
It does not work for me either, on Android Studio v2.3.3 on Linux. It is a silent failure with no log or error that I can find. This workaround works on my system:
adb [-d|-e] shell am dumpheap <package-name> /sdcard/heapdump.nhprof
adb [-d|-e] pull /sdcard/heapdump.nhprof
<path-to-AndroidSDK>/platform-tools/hprof-conv heapdump.nhprof heapdump.hprof
And then you can drag the heapdump.hprof file onto Android Studio and it will analyze and display it. Choose -d or -e depending whether you are using a USB connected device, or the emulator. Replace with your package name (usually starts with com. or org. )
Update to the newest Android Studio and macOS version. The memory dump works for me for Android Studio 2.3.2 and macOS Sierra 10.12.6. You can try to increase memory for JVM by set your Android Studio configuration. Add following settings
-Xms128m
-Xmx4096m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=200m
-XX:+UseCompressedOops
to
/Applications/Android\ Studio.app/Contents/bin/studio.vmoptions
© 2022 - 2024 — McMap. All rights reserved.