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

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

On Mon, Dec 17, 2012 at 10:01 AM, David Holmes <david.holmes at> wrote:
> 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



> David

More information about the hotspot-runtime-dev mailing list