避免初始内存堆大小错误 [英] Avoiding Initial Memory Heap Size Error

查看:159
本文介绍了避免初始内存堆大小错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下命令运行Java代码:

I run a Java code with the following command:

$ java -Xms4G -Xmx4G myjavacode

我的cpu的RAM容量是6GB。

My cpu's RAM capacity is 6GB.

然而它始终无法执行给我这个
错误消息:

However it always fail to execute giving me this error message:

Invalid initial heap size: -Xms5G
The specified size exceeds the maximum representable size.
Could not create the Java virtual machine

有没有办法设置Java选项所以我们可以
执行代码吗?

Is there any way to set up Java option so that we can execute the code?

推荐答案

您已经超出了JVM的最大堆大小。这是JVM和OS相关的。在大多数32位系统中,无论可用的物理内存如何,最大值都是2Gb。

You've exceeded the maximum heap size of your JVM. This is both JVM and OS dependent. In most 32-bit systems the maximum value will be 2Gb, regardless of the physical memory available.

这篇关于避免初始内存堆大小错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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