On Fri, 22 Jan 2021 07:06:17 GMT, Lin Zang <lz...@openjdk.org> wrote:
>> src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java >> line 490: >> >>> 488: hprofBufferedOut = null; >>> 489: } >>> 490: >> >> Can you explain what this check is for and why it is no longer needed? > > The check here is to control the segment size. It checks whether the current > segment is too large, if yes, it fills the segment size slot in > fillInHeapRecordLength() and set currentSegmentStart = 0, meaning to create > a new segment for following data write. > And thanks to point it out, there should be a similar control logic in > exitSegmentMode(), otherwise there is possibility of super huge segment. Just double checked the current implementation of segmentedOutputStream, it flush segmented data every time the exitSegmentMode() is called, so there can not be a super huge segment. But the code is still required to control the size of segmented data to not be too small. Thanks! ------------- PR: https://git.openjdk.java.net/jdk/pull/1712