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

查看:25
本文介绍了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 的物理内存.将最大堆大小设置回 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 虚拟机"问题相关的任何内容.理论上,最大堆大小不应该与初始堆大小一样重要.但我们的经验表明恰恰相反.

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 位),Internet Explorer 8.06,内存 1G注意 max-heap-size 设置为 1024m 会在具有 2G ram 的机器上引起同样的问题.

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?

谢谢,贾森

推荐答案

此问题很可能是由于无法为您的 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天全站免登陆