Last active
December 12, 2015 01:08
-
-
Save menny/4689035 to your computer and use it in GitHub Desktop.
Android Memory Leaks OR The Different Ways to Leak
This file contains hidden or 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
File extFolder = Environment.getExternalStorageDirectory(); | |
File target = new File(extFolder, "ask_mem_dump.hprof"); | |
Debug.dumpHprofData(target.getAbsolutePath()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a very simple code snippet for how to dump an Android process (current) memory into an hprof file. I write the dump file to the SDCARD, so remember to add external storage write permission.
The output is a Dalvik HPROF file! To work with standard J2ME tools (like Eclipse Memory Analyzer) you should first convert the file:
hprof-conv ask_mem_dump.hprof converted.hprof
The 'hprof-conv' tool is part of the Android SDK package.