Cannot start JVM in Java Webstart max-heap-size

We use client side java webstart to use java swing. Recently, we encountered an unusual error "Unable to start the Java virtual machine" when clicking on the jnlp link.

Soon we will find out about this because the max-heap-size parameter in the jnlp file was set to 1024 m, while most PC clients have only 1 GB of physical memory. Set the maximum heap size to 512 m, solving the problem. Currently, the corresponding line in the jnlp file looks like

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

I looked through the jnlp specification, but I can not find anything related to the "Java Virtual Machine" problem. Theoretically, the size of the max heap should not matter as the size of the initial heap. But our experience has shown the exact opposite.

Client Environment:

Windows XP SP2 (32 bit), Internet Explorer 8.06, Memory 1G Note. The maximum heap size set to 1024 m can cause the same problem on a 2 GB machine.

Basically, I'm looking for some link / specification / experience here about why this happens, and if there are any problems with this issue, besides increasing the physical memory size.

Another thing is that if we do not specify the max-heap-size size, will the actual physical memory size be used as the maximum heap size, or will the default system be used?

Thanks, JasonW

+4
source share
2 answers

This problem is probably caused by the fact that a sufficiently large area of ​​memory cannot be allocated by your JVM. A bunch of Java objects should be allocated in contiguous virtual addresses for implementation reasons.

I noticed that in a Win XP box with 2 GB of RAM, this breaks apart by about 1.5 GB (this course depends on what processes are running on each PC, so YMMV).

See the following posts for some explanation:

Maximum Maximum Java Memory in Windows XP

Why is the maximum Java heap size fixed?

+3
source

I found that the size of the source heap and the size of the max heap were not very well observed by the javaws version for Mac. In the end, I replaced them with the following:

  <j2se version="1.6+" java-vm-args="-Xmx1024m -Xms256m -Xss8m" /> 

And finally, he worked on a large heap Mac

+1
source

Source: https://habr.com/ru/post/1316236/


All Articles