IBM i - Java Heap Size

JAVA command keywords:

The GCHINL value determines how the garbage collector runs. Each time memory usage equal to the GCHINL value has been consumed, the garbage collector will be invoked. A large value makes the GC run less frequently, but for a long time.

The Java heap size settings determine the amount of memory used by the Java Virtual Machine. Note that these settings behave differently on IBM i than on other platforms.

On IBM i, the initial Java heap size specifies a threshold for the amount of memory in the JVM; once that amount of memory has been allocated, the garbage collector will begin to run.

Unlike most other JVMs, the IBM i JVM allows other threads to continue running while the garbage collector is reclaiming unused memory.

The initial heap size should be tuned so that the garbage collector runs at a suitable interval -- infrequently enough that it does not cause unnecessary overhead, yet often enough that the heap does not grow too large.

The GCHMAX value determines the maximum heap size of the JVM, the default value is *DFT.

The GCHMAX *DFT value for the IBM Classic JVM is *NOMAX.

The GCHMAX *DFT value for the IBM Technology for Java JSM is 2G.

This default value of 2G is too small for a 64-bit Java environment and needs to be increased.

Do not use the maximum value of 240000000 as the IBM Technology for Java command treats this as a *NOMAX value and defaults back to the 2G value.

From experimentation, these are the maximum GCHMAX values for IBM Java Technology for Java JDK's.

32bit  JVM's are limited to 3407872 kilobytes

         STRJSM VERSION(*JVM5032) GCHMAX(3407872)

64bit  JVM's are limited to 239861760 kilobytes

         STRJSM VERSION(*JVM5064) GCHMAX(239861760)

If you are using the shared classes option (-Xshareclasses), then the maximum GCHMAX value will be less.

Refer to the following IBM Redbook:

http://www.redbooks.ibm.com/abstracts/sg247353.html