Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jifa-dev] Custom MAT build - SnapshotInfo.getHeapLayout returns null with regular hprof

hi Jason,

'heap layout' is an internal feature to calculate cross-region references information, it should be cleaned up when we open source, but there seems to be some legacy code
We will file an issue to fix it.

Denghui
------------------------------------------------------------------
From:Jason Koch <jkoch@xxxxxxxxxxx>
Send Time:2020年8月26日(星期三) 03:02
To:jifa-dev <jifa-dev@xxxxxxxxxxx>
Subject:[jifa-dev] Custom MAT build - SnapshotInfo.getHeapLayout returns null with regular hprof

I see you have added a 'heap layout', however normal JDK hprof does not have this information, and there are numerous parts of JIFA which rely on it.

Specifically, `getHeapLayout()` can return null and is called in a few places. It can be fixed by always returning the UNKNOWN heap layout:

This works for me.
`````
  public boolean layoutAvailable() {
    return getHeapLayout().type() != HeapLayout.HeapType.UNKNOWN;
  }
 
  public HeapLayout getHeapLayout() {
    return (this.heapLayout == null) ? UNKNOWN_HEAP_LAYOUT : this.heapLayout;
  }
`````

Back to the top