RFR: JDK-8176520: Improve the accuracy of the instance size in hprof heap dumps [v2]
Alex Menkov
amenkov at openjdk.org
Wed Feb 21 03:56:53 UTC 2024
On Mon, 19 Feb 2024 09:00:16 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> > Can't the instance size as currently computed be computed by hprof tool vendors using class information already present in the hprof file (list of class fields and types, class hierarchy info, etc)?
>
> That would still be based on VM independent sizes. I think what Alex is looking for is to have HotSpot VM specific sizes be included in the heap dump. I suspect this will require rev'ing the HPROF format, in which case it opens the potential to include object layout information.
Some addition to what Chris said from my side.
The current value of the field is VM independent, but to me it doesn't reflect the description.
Reading "instance size (in bytes)" in the hprof description I interpret it as "how many bytes an instance of the class occupies in memory". As this value is not required for reading/parsing, I tend to consider current implementation as inaccurately reported value.
Updating version of the hprof format is destructive.
The only version info is the file header ("JAVA PROFILE 1.0.2"). Changing it would break all hprof tool.
It would be good to include object layout information to heap dump file (as well as other useful data like information about virtual threads), but most likely this it's too risky to include it to hprof format and should be done as part of new file format development.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17855#issuecomment-1955841131
More information about the serviceability-dev
mailing list