Reset Java webstart heap

I am trying to get webstart to dump a heap dump when it runs out of memory.

I know the jmap / jconsole way to do this, but what I really want to do is add a parameter to the jnlp file and tried the following parameters.

  • j2se version = "1.6+" java-vm-args = "- server + HeapDumpOnOutOfMemoryError" max-heap-size = "768M"
  • j2se version = "1.6+" java-vm-args = "- server -XX: + HeapDumpOnOutOfMemoryError" max-heap-size = "768M"
+6
java java-web-start
source share
2 answers

It definitely does not work if you put this parameter in a jnlp file. There is a list of allowed options, and the rest will be ignored. You can check the list of available JVM parameters in the documentation .

Note that the idea is that the end user will run your application on his computer. What would you do with a bunch of heaps on your computer? Perhaps someone in the world is launching your application. This doesn't make much sense if you are allowed to do this using the JVM end users through your JNLP file.

The only situation I can think of is access to this computer, and you can check the dump later. In this case (you, as an end user, request a dump), it is really possible if you bypass the autorun of the jnlp file from the browser and run it yourself using the javaws . The steps that I took and which led to success were as follows (suppose the jnlp file was testOOM.jnlp and you are on the windows):

  • Download the JNLP file
  • from the command line, go to the directory with the JNLP file
  • execute javaws -verbose -J-XX:+HeapDumpOnOutOfMemoryError testOOM.jnlp

Using this application will be launched in the same way as in the browser. But pay attention to the -J , which allows you to provide JVM options for JVM. This is normal because the ebd user client requested a dump.

In OutOfMemoryError heap dump will be saved in the same directory where you run the javaws command.

+2
source share

According to the Java 7 release notes, the -XX: + HeapDumpOnOutOfMemoryError parameter is now supported for the webstart application ( RFE: 6664424 ).

+4
source share

All Articles