gpt4 book ai didi

android - 使用 Eclipse 和 Mat 寻找内存泄漏,卡住转换 hprof 文件

转载 作者:行者123 更新时间:2023-11-29 14:50:37 26 4
gpt4 key购买 nike

这似乎是一个被问过很多次的问题。我正在使用 Eclipse 在 OS X 中编写一个 Android 应用程序。到目前为止,没问题,除了应用程序有时会崩溃,我想看看发生了什么,以便我可以解决问题。 (它可能与位图或变量没有正确回收有关。但我不知道从哪里开始研究它。)

我使用 DDMS 工具(在 eclipse 中)创建了一个转储文件。然后我下载了 MemoryAnalyzer 应用程序并打开它。这是我被困了一个小时的地方:我必须先转换文件,因为 Eclipse 以不同的格式写入 hprof 文件。我如何转换它?

这个问题的答案,error openning HPROF file ,直接回答我的问题。最佳答案与 hprof-conv 工具的引用相同。

The hprof file you get from Android has android specific format. You should convert hprof >file take from Android OS into standard hprof format. For this you can use hprof-conv tool >that is located at AndrodiSDK/tools/hprof-conv.

For example:

hprof-conv android.hprof mat.hprof

然后在 Memory Analyzer 中打开 mat.hprof。

我有几个问题。

  1. 当我打开 hprof-conv 工具时,它显示了一些关于它的行,然后说“[Process completed]”。并且没有地方可以输入任何文字。屏幕上唯一相关的信息是:

    Usage: hprof-conf infile outfile

  2. 我在终端中,所以我打开“新命令...”或尝试使用也打开的 shell。然后,当我运行“hprof-conv dump1.hprof dump1a.hprof”时,出现错误“找不到命令”。所以我觉得我跑题了。我还尝试了“hprof-conf”,而不是“hprof-conv”,这是它在第 1 点中建议的方式。同样的错误。还尝试了文件的各种路径,没有变化。

  3. 如果我在正确的轨道上,我该如何正确地将此命令指向文件位置?我把它放在我的桌面上,它的名字是 dump1.hprof。我对终端不是很有经验。

预先感谢您的回答,或者可能是关于如何查找内存泄漏的其他建议。

最佳答案

如果您使用的是 mac,请在命令前添加一个 ./:

./hprof-conv infile.hprof outfile.hprof

关于android - 使用 Eclipse 和 Mat 寻找内存泄漏,卡住转换 hprof 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19372055/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com