java.lang.instrument.Instrumentation.getObjectSize for java.lang.Class instance

Krystal Mok rednaxelafx at gmail.com
Sun Dec 16 18:20:40 PST 2012


On Mon, Dec 17, 2012 at 10:01 AM, David Holmes <david.holmes at oracle.com> wrote:
<snip>
>
> But the key thing is that you need two different API's here: one for regular
> objects and one for Class instances. To that end
> Instrumentation.getObjectSize is not that useful for Class instances, but I
> think the implementation chosen is not what people would generally want when
> asking about Class sizes.
>

Yes, I totally agree with having Instrumentation.getObjectSize return
a more intuitive value for Class sizes, and perhaps adding another
dedicated method for those that need the current behavior for Class.

The JavaDoc [1] for this method is quite loose. Does anybody know the
history of why there was special handling for Class in the first
place?

Regards,
Kris

[1]: http://docs.oracle.com/javase/7/docs/api/java/lang/instrument/Instrumentation.html#getObjectSize(java.lang.Object)

> David


More information about the hotspot-runtime-dev mailing list