8275021: Test serviceability/sa/TestJmapCore.java fails with: java.io.IOException: Stack frame 0x4 not found

Reviewed-by: dholmes, dcubed
This commit is contained in:
Lin Zang 2021-10-11 15:27:28 +00:00
parent 3f07337722
commit 3f01d03a10

View File

@ -615,6 +615,8 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
} else {
out.writeByte((byte)HPROF_HEAP_DUMP);
out.writeInt(0);
// We must flush all data to the file before reading the current file position.
out.flush();
// record the current position in file, it will be use for calculating the size of written data
currentSegmentStart = fos.getChannel().position();
// write dummy zero for length