5

I am new to Android Development. I want to analize the way my application uses memory. I am developing my application using Android Studio 2.1.3.

I am using Android Monitor to observe the memory ussage and I am trying to create a "hprof" file. I am clicking the "Dump Java Heap" button in memory monitor but nothing happens.

At the following link the official documentation states that the HPROF Viewer automatically appears once the hprof file is created. official documentation screenshot

Also the official documentation states that the dump files are stored in a Heap Snapshot folder so they can be viewd later.

I cannot find the folder where the dump files are stored.

I even searched all my hard disc for files with the "hprof" extension and find nothing.

Can you help me find the dump files and open it?

Liviu
  • 83
  • 1
  • 9
  • Checkout a section called "Viewing a Saved HPROF File" in the link. (The folder in finder would be captures/, if you are on mac.) If you don't see anything on capture window, your hprof may not be saved properly. – Emma Sep 02 '16 at 16:57
  • The logcat states the following I/art: hprof: heap dump "[DDMS]" starting... I/art: hprof: heap dump completed (367MB) in 32.843s. But I cannot see anything in the capture window. Any idea why is that happening? – Liviu Sep 03 '16 at 07:44
  • hmm not sure. Could you try creating smaller dump? I doubt that helps, though... I created with 22MB and it shows on the capture window. – Emma Sep 06 '16 at 18:34

2 Answers2

2

Go to Android Monitor, then Monitors, click icon that specifies Dump Java Heap under the Memory section. Your ".hprof" file will be displayed in your editor

Isaac Sekamatte
  • 5,500
  • 1
  • 34
  • 40
2

If you want to open an hprof dump file follow instruction from forth. If you want to create a dump file from your app and analyse it follow instruction from here.

first: at the first you must run your project on any android device with API above 19 and open android profiler. enter image description here

second: click create a dump file and wait

enter image description here

third: save dumpfile

enter image description here

forth: drag and drop dump file("hprof") into android studio and wait.

now you can see your dump file just by double click on each one.

also you can analyse your dump file: enter image description here

Amir133
  • 2,372
  • 2
  • 18
  • 34