Print View

Java applet in Internet Explorer crashes randomly

Issue

When using a Java application in Internet Explorer it may crash after a period of usage, with no discernible pattern or ability to replicate the fault.

If the Java Console is running (from Tools | Sun Java Console in Internet Explorer) the following error may be reported:

java.lang.OutOfMemoryError: Java heap space

Resolution

The Java heap is running out of available memory to allocate to the Java application.

The Java heap space can be increased from it's default of 64Mb using the Java Control Panel:

- Select Start | Control Panel | Java Plugin
- Select the Advanced tab
- Enter "-Xmx384m -Djavaplugin.maxHeapSize=384m" in Java Runtime Parameters (no quotes)
- Click Apply
- Close the Control Panel applet

Alternatively to automate the setting add the following line to %APPDATA%\Sun\Java\Deployment\deployment.properties:

javaplugin.jre.params=-Xmx384m -Djavaplugin.maxHeapSize\=384m


To test that the settings have been applied in Internet Explorer:

- Select Tools | Sun Java Console
- Press s in the java console to dump system properties

Check for the following two lines:

javaplugin.jre.params = -Xmx384m -Djavaplugin.maxHeapSize=384m
javaplugin.maxHeapSize = 384m

Other parameters that may assist are:

-Xms Sets the initial size, in bytes, of the memory allocation pool.
-XX:MaxDirectMemorySize setting (default is 64MB) cannot exceed the -Xmx value
-Xss Set thread stack size. Do not exceed the -Xmx value

-XX:+HeapDumpOnOutOfMemoryError Dump heap to file when java.lang.OutOfMemoryError is thrown.
-XX:HeapDumpPath Path to directory or filename for heap dump
-Xloggc Report on each garbage collection event

e.g. in Java Runtime Parameters in the Java Control Panel
-Xms384m -Xmx384m -Djavaplugin.maxHeapSize=384m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:\ -Xloggc:C:\JavaGC.log

References

Products

Sun Java 1.4.2
Microsoft Internet Explorer 6 SP1

Created: 22nd February 2008
Updated: 17th April 2008

Print View

© 2005-2024 Jamie Morrison