一个引用一个对象在32位JVM(至少在热点)都将占用4字节。
A reference to an Object on a 32 bit JVM (at least on Hotspot) takes up 4 bytes.
请问64位的热点JVM需要8个字节?或者是一些巧妙的融为一体pression怎么回事?
如果不是这样,每个对象[]
将需要两倍的堆内存,我不知怎么想(希望,期待)是不是这样的。
Does the 64 bit Hotspot JVM need 8 bytes? Or is some clever compression going on?
If not, every Object[]
would require twice as much heap memory, which I somehow think (hope, expect) is not the case.
更新/额外的问题:这是否真的很重要,或者这是一个微不足道的增加,因为多数引用指向,比几个字节的更大的(而有人可能会争辩说,这些对象是对象又主要包含对其他对象的)?
Update/extra question: Does this really matter, or is this a negligible increase, because most references point to objects that are much larger than a few bytes (whereas one might argue that those objects are in turn mostly comprised of references to other objects)?
在64位系统中,对象引用通常是8个字节。但在来自Sun /甲骨文最近的JVM可以启用的COM pressed哎呀,从而降低参考大小为4字节的上堆大小较小的限制成本。
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.