Memory requirements of an Object reference on a 64 bit JVM

后端 未结 2 391
醉话见心
醉话见心 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-17 11:12

    According to Java Platform Performance it is not strictly defined, but typically 8 bytes on a 64-bit system:

    The size of a reference isn't well defined, but it is typically 4 bytes on a 32-bit system and 8 bytes on a 64-bit system.

提交回复
热议问题