Memory requirements of an Object reference on a 64 bit JVM

后端 未结 2 375
醉话见心
醉话见心 2020-12-17 10:43

A reference to an Object on a 32 bit JVM (at least on Hotspot) takes up 4 bytes.

Does the 64 bit Hotspot JVM need 8 bytes? Or is some clever compression going on? If

2条回答
  •  有刺的猬
    2020-12-17 11:28

    In a 64-bit system, object references are typically 8-byte long. But in recent JVMs from Sun/Oracle you can enable Compressed Oops, which reduce reference size to 4 bytes at the cost of a smaller limit on heap size.

提交回复
热议问题