RFR 8231146: Heap object size

Mandy Chung mandy.chung at oracle.com
Thu Sep 19 16:30:08 UTC 2019

Hi Roger,

I was OOO last two days and back on this RFR.

It's okay to add this experimental API in java.util.Objects.  We can 
revisit if there is a better name (or no better method name) in the 
future.   It would be good for the javadoc to state that the returned 
size is an implementation-specific approximation of the amount of 
storage consumed by this object.  The estimate may change in different 
invocation of the JVM.


On 9/17/19 1:00 PM, Roger Riggs wrote:
> Please review and comment:
> This request adds a (probably temporary) API to return the heap size 
> of an object.
> In prototyping with inline classes it will be useful to know an 
> approximation of the size of an object in the heap while prototyping 
> various tradoffs in performance and data structures.
> Webrev:
>   http://cr.openjdk.java.net/~rriggs/webrev-object-size-8231146/
> Thanks, Roger

More information about the valhalla-dev mailing list