【问题标题】:I can't convert Android HPROF to standard HPROF on Lollipop我无法在 Lollipop 上将 Android HPROF 转换为标准 HPROF
【发布时间】:2015-09-05 03:41:31
【问题描述】:

我的测试设备版本是 5.0.1 (Lollipop)。

我在 Android Studio 1.3 中获得了 Android 堆转储文件。

但是我看到了错误信息。

所以我尝试在 DDMS 中获取转储文件(示例文件名:android.hprof)。

然后我尝试将 Android HPROF 转换为标准 HPROF 文件。

hprof-conv android.hprof standard.hprof

然后hprof-conv返回消息ERROR: read 40070 of 65559 bytes

谁来帮帮我。

【问题讨论】:

  • 你找到这个问题的原因了吗?
  • 出现同样的错误:磁头转储的内容似乎有问题。如果我重新启动平板电脑并在我的应用程序的其他地方进行头部转储,它就可以工作。如果我进行我怀疑会泄漏的操作......它会失败。
  • 没有可用空间时出现此错误。

标签: android hprof


【解决方案1】:

https://android.googlesource.com/platform/dalvik.git/+/android-4.2.2_r1/tools/hprof-conv/HprofConv.c#221

/*
 * Read some data, adding it to the expanding buffer.
 *
 * This will ensure that the buffer has enough space to hold the new data
 * (plus the previous contents).
 */
static int ebReadData(ExpandBuf* pBuf, FILE* in, size_t count, int eofExpected)
{
    size_t actual;
    assert(count > 0);
    ebEnsureCapacity(pBuf, count);
    actual = fread(pBuf->storage + pBuf->curLen, 1, count, in);
    if (actual != count) {
        if (eofExpected && feof(in) && !ferror(in)) {
            /* return without reporting an error */
        } else {
            fprintf(stderr, "ERROR: read %d of %d bytes\n", actual, count);
            return -1;
        }
    }
    pBuf->curLen += count;
    assert(pBuf->curLen <= pBuf->maxLen);
    return 0;
}

【讨论】:

    猜你喜欢
    • 2015-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-12
    • 2020-11-27
    • 1970-01-01
    • 2011-09-22
    • 2019-10-23
    相关资源
    最近更新 更多