Skip to content

Commit adf305e

Browse files
committed
GH-631 shortcut added to handle heapdump with just one segment (this is 99.99% cases)
1 parent 84d45e8 commit adf305e

File tree

1 file changed

+10
-1
lines changed
  • visualvm/libs.profiler/lib.profiler.heap/src/org/graalvm/visualvm/lib/jfluid/heap

1 file changed

+10
-1
lines changed

visualvm/libs.profiler/lib.profiler.heap/src/org/graalvm/visualvm/lib/jfluid/heap/HprofHeap.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,16 @@ private void heapDumpSegIterator(SegmentConsumer sc) throws IOException {
13121312
TagBounds heapDumpSegmentBounds = tagBounds[HEAP_DUMP_SEGMENT];
13131313

13141314
if (heapDumpSegmentBounds != null) {
1315-
heapDumpSegmentBounds = heapDumpSegmentBounds.union(tagBounds[HEAP_DUMP_END]);
1315+
TagBounds heapDumpEndBounds = tagBounds[HEAP_DUMP_END];
1316+
if (heapDumpEndBounds == null) {
1317+
throw new IOException("Heap dump is broken.\nTag 0x"+Integer.toHexString(HEAP_DUMP_END)+" is missing."); // NOI18N
1318+
}
1319+
if (heapDumpSegmentBounds.endOffset == heapDumpEndBounds.startOffset) {
1320+
// shortcut - just one segment
1321+
sc.accept(heapDumpSegmentBounds.startOffset,heapDumpSegmentBounds.endOffset);
1322+
return;
1323+
}
1324+
heapDumpSegmentBounds = heapDumpSegmentBounds.union(heapDumpEndBounds);
13161325
long start = heapDumpSegmentBounds.startOffset;
13171326
long[] offset = new long[] { start };
13181327
long segmentStart = 0;

0 commit comments

Comments
 (0)