RFR (M) 8234510: Remove file seeking requirement for writing a heap dump

Laurence Cable larry.cable at oracle.com
Mon Nov 25 17:10:37 UTC 2019


What (if any) is the compatibility impact of this change on tools 
consuming the heap dump format?

Thanks

- Larry


On 11/25/19 6:41 AM, Schmelter, Ralf wrote:
> Hello,
>
> this change removes the need to use seek on the hprof file when creating a heap dump, thus making it possible to stream the dump. This enables us to dump to a socket or directly gzip the dump.
>
> Instead of fixing the heap dump segments size on the written file, the size of the heap dump segments is either fixed up in the buffer instead or, for entries to big to fit into the buffer fully, the entry get its own segment with no need to fix up the segment size later.
>
> To do this, we now need to know how large an heap dump segment entry is when starting to write the entry. This is either trivial (for the roots) or already known (for the instance and array dump entries). Just the class entry needed a little more code to track the size.
>
> The change results in more heap dump segments in the written heap dump. But since the overhead per segment is 9 bytes, even for the smallest used buffer (64K) the overhead is less than 0.02%. Additionally the heap dump now expects to be able to allocate at least 64k for the buffer. The old code tried to run even with a buffer of 1 byte or no buffer at all.
>
> Bugreport: https://bugs.openjdk.java.net/browse/JDK-8234510
> Webrev: http://cr.openjdk.java.net/~rschmelter/webrevs/8234510/webrev.0/
>
> Best regards,
> Ralf



More information about the serviceability-dev mailing list