Memory Analyzer Tool in android?

前端 未结 7 2101
醉酒成梦
醉酒成梦 2020-11-27 16:31

I just want to know how to work with Memory analyzer tool in android. Please tell me how to do this to know about memory leaks for a particular project. Can someone give me

7条回答
  •  半阙折子戏
    2020-11-27 16:54

    • Install MAT.

    • Go to Tools->Android ->Android device monitor(DDMS)

    • In the top left side under Devices,select the project name and click Update Heap.

    • Then Click Dump HPROF File and saved it in desktop.

    • Then run the Command prompt and point out the Android-sdk directory.

      For an Example: hprof-conv is located in E directory. So run the command as cd android/sdk/platform-tools.

    • Then finally run this command by referring this doc to convert this file format to read it in MAT.

      E:\Android\sdk\platform-tools> hprof-conv "C:\Users\Steve\Desktop\yourfilename.hprof" "C:\Users\Steve\Desktop\leakage.hprof"

    • Now your file will converted to leakage.hprof.check this file and open it in MAT.

    Edit: Click details,then it will show the class names.In that Left Click -> Path To GC Roots ->With all references.Then it shows the class name.

提交回复
热议问题