问题描述
我已经 32位Windows上的最大堆大小〜 1.5GB,这是因为JVM需要连续的内存。有人可以解释连续内存的概念以及为什么在Windows上只有1.5GB的最大值?
I've read the max heap size on 32bit Windows is ~1.5GB which is due to the fact that the JVM requires contiguous memory. Can someone explain the concept of "contiguous memory" and why you only have max 1.5GB on Windows?
其次,64位Windows上的最大堆大小是多少?为什么这与32位可用的不同?
Secondly, what then is the max heap size on 64 bit Windows and why is this different than what's available on 32 bit?
推荐答案
32位/ 64位部分与Java无关
The 32-bit/64-bit part is unrelated to Java
事实证明,32位系统中的内存位置由32位无符号整数引用。这允许最多2 ^ 32个可能的存储位置。由于每个位置存储1个字节,因此您可以获得2 ^ 32个字节或4 GB。
It turns out that memory locations in a 32-bit system are referenced by 32-bit unsigned integers. This allows up to 2^32 possible memory locations. Since each location stores 1 byte you get 2^32 bytes or 4 GB if you prefer.
在64位系统上有2 ^ 64个位置,或16艾字节。
On a 64 bit system there are 2^64 locations, or 16 exabytes.
现在,在Windows中,连续的部分成为一个大问题,但这就是Windows的工作方式。这个想法是你需要为你的堆提供一个完整的不间断范围。可悲的是,Windows在中间某处分配了一些内存。这基本上会让你大约一半的左侧或一半的右侧,大约1.5-2GB的块,以分配你的堆。
Now, in Windows, the contiguous part becomes a big issue, but that is just how Windows does things. The idea is that you need to have an entire "uninterrupted" range for your heap. Sadly, Windows allocates some memory somewhere in the middle. This basically leaves you with about half the left side or half the right side, about 1.5-2GB chunks, to allocate your heap.
签出有关32对64位的详细信息。
Check out this question for more details on 32 vs 64 bit.
编辑:感谢mrjoltcola提供exa前缀!
Thanks mrjoltcola for the exa prefix!
这篇关于了解最大JVM堆大小 - 32位与64位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!