At this point, hprof dumper iterates the fields trying the deduce the instance size. However, this is prone to errors in estimations, because:
a) object header sizes can be changed without notice;
b) object fields can be aligned/padded for correctness/performance reasons
We have already identified that with upcoming @Contended, hprof estimates can be terribly wrong, see:
http://cs.oswego.edu/pipermail/concurrency-interest/2012-November/010276.html
Luckily, VM already knows the exact instance size, and we can just reuse this info.
a) object header sizes can be changed without notice;
b) object fields can be aligned/padded for correctness/performance reasons
We have already identified that with upcoming @Contended, hprof estimates can be terribly wrong, see:
http://cs.oswego.edu/pipermail/concurrency-interest/2012-November/010276.html
Luckily, VM already knows the exact instance size, and we can just reuse this info.
- relates to
-
JDK-8327709 Heap dump should provide information about actual instance size
-
- Open
-
-
JDK-8176520 Improve the accuracy of the instance size in hprof heap dumps
-
- Closed
-