Java: How much memory a reference implies?

前端 未结 1 1129
被撕碎了的回忆
被撕碎了的回忆 2021-01-21 09:41

As the question says, how much memory is used for a reference to an Object in the Java Programming Language?

Please, if you have a trusted source is better.

Than

1条回答
  •  别那么骄傲
    2021-01-21 10:16

    It's not specified by the language or JVM spec. However, it's generally accepted that any sane implementation will be 4 bytes on a 32-bit machines and between 4 and 8 bytes (depending on compressed pointer settings, etc.) on a 64-bit machine.

    0 讨论(0)
提交回复
热议问题