RFR: JDK-8176520: Improve the accuracy of the instance size in hprof heap dumps [v2]
Alex Menkov
amenkov at openjdk.org
Sat Feb 17 02:32:55 UTC 2024
On Sat, 17 Feb 2024 01:40:44 GMT, Chris Plummer <cjplummer 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)? If so, then they have recourse if they prefer the current representation of "instance size", and manually computing the size in this manner would work with older hprof files too.
Yes, hprof tools can calculate current "instance size" value (all required class information is present in hprof, it's required to parse HPROF_GC_INSTANCE_DUMP records).
They do not rely on "instance size" field, instead they calculate "actual" size from class/field information using tricks to detect header size, alignment/padding, compressed oops.
This logic will continue to work with old and new hprof files, but tool vendors can detect "new" hprof and use "actual instance size" value.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17855#issuecomment-1949611174
More information about the serviceability-dev
mailing list