java maxheap,Java webstart max-heap-size导致JVM无法启动

本文讨论了Java Webstart中由于最大堆大小设置过大(1024M)导致在客户端内存有限(1GB)时出现'无法启动Java虚拟机'的问题。文章介绍了问题原因,即内存分配不连续引发的错误,并提到初始堆大小可能比最大堆更重要。作者寻求关于此现象的解释、避免措施,以及默认堆大小选择的疑问。

We use java webstart on the client side for a java swing based aplication. Recently we have been experiencing a weird "Cannot start java Virtual machine " error when clicking in the jnlp link.

We soon find out its because the max-heap-size setting in the jnlp file was set to 1024m whereas most of the clients PC only have 1 gb physical memory. Set the max-heap-size back to 512m solved the problem.

Currently, the relevant line in the jnlp file looks like

I looked into the jnlp spec, but cannot find anything related to the "Java Virtual machine" issue. In theory the max-heap-size should not matter as much as the initial-heap-size. But our experience suggested quite the contrary.

The client environment:

Windows XP SP2 ( 32bit ), Internet Explorer 8.06, Memory 1G

Note max-heap-size set to 1024m can cause the same problem on a machine with 2G ram.

Basically, what I am looking for here is some reference/spec/experience about why this is happening, and if there is any get-round for this issue besides increasing the physical memory size.

Another thing is that if we leave the max-heap-size unspecified, will the actual physical memory size be used as the max-heap-size, or a system-default one will be used?

Thanks,

JasonW

解决方案

It is likely that this problem is caused by the fact that a sufficiently large memory area could not be allocated to your JVM. The Java object heap has to be allocated in contiguous virtual addresses, for implementation reasons.

I noticed that on a Win XP box with 2 Gb RAM this breaks at around 1.5 GB (this off course varies depending on what processes are running on each PC, so YMMV).

Checkout the following posts for some explanations:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值