64位Java的最大内存 [英] Max memory for 64bit Java

查看:763
本文介绍了64位Java的最大内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在64位平台上,可以为Java分配的最大堆空间量是多少?是否无限制?

What's the maximum amount of heap space that one can allocate for java on a 64-bit platform? Is it unlimited?

推荐答案

理论上2 64 ,但可能存在局限性(显然)

Theoretically 264, but there might be limitations (obviously)

根据此常见问题解答它仅受本地系统上的内存和交换空间的限制:

According to this FAQ it's only limited by memory and swap space on the local system:

在64位VM上,您可以使用64位可寻址性,从而导致最大Java堆大小仅受物理量的限制系统提供的内存和交换空间。
On 64-bit VMs, you have 64 bits of addressability to work with resulting in a maximum Java heap size limited only by the amount of physical memory and swap space your system provides.

参见为什么我不能使用32位JVM获得更大的堆?

See also Why can't I get a larger heap with the 32-bit JVM?

另外请记住,您需要通过命令行设置最大堆。没有-Xmx命令。没有它根据相同的FAQ,Java在64位计算机上使用64mb + 30%= 83.2mb作为默认最大堆。

Also keep in mind you need to set the max heap via command line. Without an -Xmx command. without it Java uses 64mb + 30% = 83.2mb as a default max heap on 64 bit machines according the same FAQ.

java -Xmx1000g myClass 

在我的机器上运行正常。但它似乎还不支持't'修饰符,所以你不能用太字节来指定最大内存:)

works fine on my machine. But it dosn't seem to yet support the 't' modifier so you can't specify max memory in terabytes yet :)

这篇关于64位Java的最大内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆