Java webstart max-heap-size导致JVM无法启动 [英] Java webstart max-heap-size causes JVM cannot be started

查看:663
本文介绍了Java webstart max-heap-size导致JVM无法启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在客户端使用java webstart来实现基于java swing的应用程序。最近,当点击jnlp链接时,我们遇到了一个奇怪的无法启动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.

我们很快发现它,因为jnlp文件中的max-heap-size设置设置为1024m,而大多数客户端PC只有1 gb物理内存。将max-heap-size设置回512m解决了问题。
目前,jnlp文件中的相关行看起来像

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

 <j2se version="1.5+" initial-heap-size="100m" max-heap-size="512m"/>

我查看了jnlp规范,但找不到与Java虚拟机问题相关的任何内容。从理论上讲,max-heap-size应该与初始堆大小无关。但我们的经验表明情况恰恰相反。

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.

客户端环境:

Windows XP SP2(32位),互联网Explorer 8.06,内存1G
注意max-heap-size设置为1024m可能会导致2G内存机器出现同样的问题。

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.

另一件事是,如果我们不指定max-heap-size,那么将实际的物理内存大小用作max-heap-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?

谢谢,
JasonW

Thanks, JasonW

推荐答案

这个问题很可能是因为无法将足够大的内存区域分配给JVM。出于实现原因,必须在连续的虚拟地址中分配Java对象堆。

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.

我注意到在带有2 Gb RAM的Win XP盒子上,它突破了大约1.5 GB(这个过程取决于每台PC上运行的进程,所以YMMV )。

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:

Windows XP上的Java最大内存

为什么修复了Java堆的最大大小?

这篇关于Java webstart max-heap-size导致JVM无法启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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