java 增加内存_java – 有尝试增加jvm内存时可以设置Xmx的最大数量?

是的,有一个最大值,但它是系统依赖。尝试看看,加倍,直到你达到极限,然后向下搜索。至少有Sun JRE 1.6 on linux你会得到有趣的,如果不是总是信息性错误消息(peregrino是netbook运行32位ubuntu与2G RAM和没有互换):

peregrino:$ java -Xmx4096M -cp bin WheelPrimes

Invalid maximum heap size: -Xmx4096M

The specified size exceeds the maximum representable size.

Could not create the Java virtual machine.

peregrino:$ java -Xmx4095M -cp bin WheelPrimes

Error occurred during initialization of VM

Incompatible minimum and maximum heap sizes specified

peregrino:$ java -Xmx4092M -cp bin WheelPrimes

Error occurred during initialization of VM

The size of the object heap + VM data exceeds the maximum representable size

peregrino:$ java -Xmx4000M -cp bin WheelPrimes

Error occurred during initialization of VM

Could not reserve enough space for object heap

Could not create the Java virtual machine.

(experiment reducing from 4000M until)

peregrino:$ java -Xmx2686M -cp bin WheelPrimes

(normal execution)

大多数都是自我解释,除了-Xmx4095M这是相当奇怪(可能是一个有符号/无符号比较?),它声称保留2686M在2GB机器没有交换。但它暗示,最大大小是4G不是2G的32位VM,如果操作系统允许你解决这个问题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值