RFR 8231146: Heap object size
Roger.Riggs at oracle.com
Fri Sep 20 16:38:58 UTC 2019
Yes, JOL will need an update. It thinks all object fields size is just a
I included an inline class Point(int x, int y)...
M Layout Simulation
(org.openjdk.jol.datamodel.CurrentDataModel at 433f4e98, field allocation
Class150176 object internals:
OFFSET SIZE TYPE
0 12 (object
12 4 (alignment/padding gap)
16 8 long
24 2 short
26 1 byte
27 1 (alignment/padding gap)
28 4 java.lang.Object
32 4 org.openjdk.jol.util.Point
36 4 org.openjdk.jol.util.Point
40 8 double
48 2 short
50 6 (loss due to the next object
Instance size: 56 bytes
Space losses: 5 bytes internal + 6 bytes external = 11 bytes total
On 9/20/19 9:03 AM, Roger Riggs wrote:
> Hi Aleksey,
> I'll have to try it, but I don't expect it to be able to understand
> the embedding
> in objects or arrays without an update.
> This is for exploratory work on using inline classes and algorthms.
> JOL is not in an API in java.base that can be used to dynamically adjust
> data structures based on actual embedding.
> I expect any long term APIs to be different and more detailed.
> Thanks, Roger
> On 9/20/19 8:47 AM, Aleksey Shipilev wrote:
>> On 9/17/19 10:00 PM, Roger Riggs wrote:
>>> 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.
>> Any reason why JOL does not work?
>> It already calls through the existing interfaces to figure out the object size.
More information about the valhalla-dev