[concurrency-interest] @Contended (JEP-142)

Aleksey Shipilev aleksey.shipilev at oracle.com
Fri Nov 30 09:44:15 EST 2012


On 11/30/2012 06:32 PM, Vitaly Davidovich wrote:
> Why is header reported as 12 bytes? Should that not be two words (16
> bytes on x64)?

This starts to get off-topic.

This is the estimate of the first field's offset, might be not the
header itself. CompressedOops allow me to do this, see:

$ java -XX:-UseCompressedOops
Test8003985.Test2
   (header 16 bytes)
  16   4             int Test2.int2
   (gap 128 bytes)
 148   4             int Test2.int1
Instrumentation reports 280 bytes per instance

$ java -XX:+UseCompressedOops
Test8003985.Test2
   (header 12 bytes)
  12   4             int Test2.int2
   (gap 128 bytes)
 144   4             int Test2.int1
Instrumentation reports 280 bytes per instance

The impact of that 4 bytes is eaten up by alignment to 8 anyway.

-Aleksey.



More information about the Concurrency-interest mailing list