IBM BPM, V8.0.1, All platforms > Tuning > Advanced tuning > Advanced Java heap tuning

Reduce or increase heap size if out-of-memory errors occur

The java.lang.OutOfMemory exception is used by the JVM in a variety of circumstances, making it sometimes difficult to track down the source of the exception. There is no conclusive mechanism for telling the difference between these potential error sources, but a good start is to collect a trace using verbosegc.

If the problem is a lack of memory in the heap, then this is easily seen in this output. Many garbage collections that produce very little free heap space generally occur preceding this exception. If this is the problem, increase the size of the heap. You can use the administrative console to change the size of the heap:

  1. In the administrative console, click Servers > Server Types > WebSphere application servers > server_name.
  2. In the Server Infrastructure section, click Java and process management > Process definition > Java virtual machine.
  3. In the Server Infrastructure section, click Java and process management > Process definition, select either Control or Servant, and then select Java virtual machine.
  4. Set a new value for the size of the heap.

If, however, there is enough free memory when the java.lang.OutofMemory exception is thrown, the next item to check is the finalizer count from the verbosegc. If these appear high, then a subtle effect might be occurring whereby resources outside the heap are held by objects within the heap and being cleaned by finalizers. Reducing the size of the heap can alleviate this situation, by increasing the frequency at which finalizers are run. In addition, examine your application, to determine if the finalizers can be avoided, or minimized.

Out-of-memory errors can also occur for issues unrelated to JVM heap usage, such as running out of certain system resources. Examples of this include insufficient file handles or thread stack sizes that are too small.

In some cases, you can tune the configuration to avoid running out of native heap: try reducing the stack size for threads (the -Xss parameter). However, deeply nested methods can force a thread stack overflow in case of insufficient stack size.

For middleware products, if you are using an in-process version of the JDBC driver, it is usually possible to find an out-of-process driver that can have a significant effect on the native memory requirements.

For example, you can use Type 4 JDBC drivers, MQSeries can be switched from Bindings mode to Client mode, and so on. See the documentation for the products in question for more details.

For further information about tuning the Java™ heap for WebSphere Application Server for z/OS , see the performance tuning information in the WebSphere Application Server for z/OS Information Center.

Advanced Java heap tuning


Related concepts:
Monitoring garbage collection