Java堆大小:设置太大时出错
我有一个程序,基本上需要大量内存。然而,由于某种原因,当我尝试将最大堆空间设置为 1.5GB 以上时,java 给出了一个错误。也就是说,运行
java -Xmx1582m [my program]
没问题,但是
java -Xmx1583m [my program]
给出了错误
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
我在 Windows 命令行和 Eclipse 中都遇到了相同的错误。
以下是我的系统配置:
Windows 7(64 位)
Intel Core 2 Quad CPU
安装的 RAM:8.00 GB
Java 版本 1.6.0
奇怪的是,即使我运行 64 位操作系统,我也只能设置 1.5GB 内存8 GB 内存。有办法解决这个问题吗?
I have a program that fundamentally requires a lot of memory. However, for some reason java gives me an error when I try to set the max heap space above 1.5GB. That is, running
java -Xmx1582m [my program]
is okay, but
java -Xmx1583m [my program]
gives the error
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
I got the same error in both Windows command line and Eclipse.
Here are my system configurations:
Windows 7 (64-bit)
Intel Core 2 Quad CPU
Installed RAM: 8.00 GB
Java version 1.6.0
It is weird that I can only set 1.5GB memory even though I'm running 64-bit OS with 8 GB RAM. Is there a way to work around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能的情况是,虽然您的操作系统是 64 位,但 JVM 不是。打开命令行并输入 java -version 将为您提供详细的版本信息,该信息应指示您安装的 JVM 是 32 位还是 64 位版本。
64 位 JVM 应该不会遇到更高的内存限制。
The likely case is that while your operating system is 64-bit, your JVM is not. Opening a command line and typing
java -version
will give you the verbose version information, which should indicate whether your installed JVM is a 32 or 64-bit build.A 64-bit JVM should have no problem with the higher memory limits.
对于堆空间被使用
For heap space is used