On Mon, 13 Sep 2021 16:12:48 GMT, Ralf Schmelter <[email protected]> wrote:
>> Lin Zang has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> fix build error
>
> src/hotspot/share/services/heapDumper.cpp line 1797:
>
>> 1795: if (o->is_instance()) {
>> 1796: InstanceKlass* ik = InstanceKlass::cast(o->klass());
>> 1797: size = DumperSupport::instance_size(ik);
>
> Getting the size of an instance can be surprisingly expensive for classes
> with many static fields, since we iterate over all static fields of the
> class. So I would avoid having to calculate the size twice (here and when we
> are actually dump it). Maybe here it would just be enough to use o->size() *
> 8 as an upper limit value of the real size in the heap dump. After all
> practically no non-array object will ever we that large.
Good suggestion! I didn't realize that o->size() * 8 can be used as an upper
limit.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2261