什么是可能的最大堆大小与64位JVM?大堆、大小、JVM

2023-09-07 22:28:02 作者:百里公子世无双

这可与 -Xmx 在32位系统中设置的理论最大堆值是当然的 2 ^ 32 字节,但通常(参见:Understanding最大JVM堆大小 - 32位VS 64 )一个人不能使用所有4GB

The theoretical maximum heap value that can be set with -Xmx in a 32-bit system is of course 2^32 bytes, but typically (see: Understanding max JVM heap size - 32bit vs 64bit) one cannot use all 4GB.

有关在64位计算机上的64位操作系统的64位JVM上运行,有没有除了对 2 ^ 64 字节或理论极限的任何限制16艾字节?

For a 64-bit JVM running in a 64-bit OS on a 64-bit machine, is there any limit besides the theoretical limit of 2^64 bytes or 16 exabytes?

我知道,由于种种原因(主要是垃圾回收),过大的堆可能不是的聪明的,但在光与RAM的T字节阅读有关服务器,我不知道什么是可能的。

I know that for various reasons (mostly garbage collection), excessively large heaps might not be wise, but in light of reading about servers with terrabytes of RAM, I'm wondering what is possible.

推荐答案

如果您要使用32位的参考,你的堆限制为32 GB。

If you want to use 32-bit references, your heap is limited to 32 GB.

不过,如果你愿意用64位的引用文件,其大小可能被你的操作系统的限制,只是因为它是与32位JVM。例如在Windows 32位,这是1.2到1.5 GB。

However, if you are willing to use 64-bit references, the size is likely to be limited by your OS, just as it is with 32-bit JVM. e.g. on Windows 32-bit this is 1.2 to 1.5 GB.

请注意:即使您使用在堆32位的参考,您可以访问大量直接存储器和内存映射的大小。即使用远高于32 GB。

Note: You can access large direct memory and memory mapped sizes even if you use 32-bit references in your heap. i.e. use well above 32 GB.

的COM pressed哎呀在HotSpot JVM中

的COM pressed糟糕重新present管理指针(在许多但不是在JVM所有场所),为32位值必须由8倍缩放,并添加到64位基地址找到它们引用的对象。这使得应用程序可以处理多达四十亿对象(不是字节),或者一个堆大小约32GB。与此同时,数据结构紧凑是有竞争力与ILP32模式

Compressed oops represent managed pointers (in many but not all places in the JVM) as 32-bit values which must be scaled by a factor of 8 and added to a 64-bit base address to find the object they refer to. This allows applications to address up to four billion objects (not bytes), or a heap size of up to about 32Gb. At the same time, data structure compactness is competitive with ILP32 mode.