Skip to content

Commit 8876eae

Browse files
author
Lin Zang
committed
8269685: Optimize HeapHprofBinWriter implementation
8262386: resourcehogs/serviceability/sa/TestHeapDumpForLargeArray.java timed out Reviewed-by: sspitsyn, amenkov
1 parent c880b87 commit 8876eae

File tree

3 files changed

+182
-344
lines changed

3 files changed

+182
-344
lines changed

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void prologue(long usedSize) {
5959

6060
public boolean doObj(Oop oop) {
6161
try {
62-
writeHeapRecordPrologue();
62+
writeHeapRecordPrologue(calculateOopDumpRecordSize(oop));
6363
if (oop instanceof TypeArray) {
6464
writePrimitiveArray((TypeArray)oop);
6565
} else if (oop instanceof ObjArray) {
@@ -127,6 +127,8 @@ public void epilogue() {
127127
}
128128
}
129129

130+
abstract protected int calculateOopDumpRecordSize(Oop oop) throws IOException;
131+
130132
protected void writeJavaThreads() throws IOException {
131133
Threads threads = VM.getVM().getThreads();
132134
for (int i = 0; i < threads.getNumberOfThreads(); i++) {
@@ -420,6 +422,9 @@ protected void writeHeapFooter() throws IOException {
420422
protected void writeHeapRecordPrologue() throws IOException {
421423
}
422424

425+
protected void writeHeapRecordPrologue(int size) throws IOException {
426+
}
427+
423428
protected void writeHeapRecordEpilogue() throws IOException {
424429
}
425430

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,11 @@ protected void writeHeapFooter() throws IOException {
275275
out.println("</gxl>");
276276
}
277277

278+
@Override
279+
protected int calculateOopDumpRecordSize(Oop oop) throws IOException {
280+
return 0;
281+
}
282+
278283
//-- Internals only below this point
279284

280285
// Java identifier to XML NMTOKEN type string

0 commit comments

Comments
 (0)