简体   繁体   English

如何将android中的堆转储转换为eclipse格式

[英]How to convert a heap dump in android to eclipse format

Im attempting to analyze a memory leak that has been driving me crazy for weeks, I found out about the eclipse MAT tool that helps you to figure out what is wrong, the problem is every single tutorial I have found says that I need to convert the format of the file from dalvik to HPROF format, however not one single tutorial I can find explains how to actually do it, instead I get vague things like this 我试图分析一直让我疯狂数周的内存泄漏,我发现了一个日食MAT工具,可以帮助你弄清楚什么是错的,问题是我发现的每一个教程都说我需要转换从dalvik到HPROF格式的文件格式,但是我找不到一个单独的教程解释了如何实际做到这一点,而是我得到了这样模糊的东西

Now the file you will get does not conform to the "standard" Sun .hprof format but is written in Dalvik's own format and you need to convert it: 现在您将获得的文件不符合“标准”Sun .hprof格式,但是以Dalvik自己的格式编写,您需要将其转换为:

hprof-conv heap-dump-tm-pid.hprof 4mat.hprof

what does that actually mean? 这究竟意味着什么? what do I click? 我点击什么? where do I go? 我要去哪? Im totally lost and frustrated, any help will go a long way, thanks. 我完全迷失和沮丧,任何帮助都会走很长的路,谢谢。

Sounds like you need to use the hprof-conv tool that's located in [Android-SDK]\\platform-tools . 听起来你需要使用位于[Android-SDK]\\platform-toolshprof-conv [Android-SDK]\\platform-tools

To do this on Windows: 要在Windows上执行此操作:

  1. Press WINKEY + R and type in cmd WINKEY + R并输入cmd
  2. Type in: 输入:

    cd "C:\\android-sdk\\platform-tools" (or whichever directory contains your Android sdk) cd "C:\\android-sdk\\platform-tools" (或任何包含Android sdk的目录)

  3. Assuming you have your Dalvik file on the Desktop (I'm just guessing the directory), type in: 假设你在桌面上有你的Dalvik文件(我只是猜测目录),输入:

    hprof-conv "C:\\Users\\Edmund\\Desktop\\heap-dump-tm-pid.hprof" "C:\\Users\\Edmund\\Desktop\\4mat.hprof"

  4. This will generate the standard format HPROF file that you can use called 4mat.hprof 这将生成标准格式HPROF文件,您可以使用该文件称为4mat.hprof

Just to be said: You don't explicitly need to convert the .hprof file using hprof-conv . 只是要说 :你没有明确需要使用hprof-conv转换.hprof文件。 MAT does this for you automatically - as described here . MAT自动为您完成此操作 - 如此处所述 In Eclipse, 在Eclipse中,

  1. open the Preferences Window, 打开首选项窗口,
  2. navigate to Android > DDMS 导航到Android > DDMS
  3. and change the HPROF action to "Open in Eclipse" . 并将HPROF操作更改为“在Eclipse中打开”

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM