Reducing or increasing heap size if java.lang.OutOfMemoryError occurs

The java.lang.OutofMemoryError is used by the JVM in a variety of circumstances. The exception occurs if there is not enough heap space for an object in the heap, or if other resources outside the Java heap have been exhausted.

Read the output from java.lang.OutofMemoryError to see if the problem is due to a lack of memory in the heap. If so, increase the size of the heap.

If the heap appears to be large enough, check the finalized count from the -verbose:gc. If the count appears high, resources outside the heap might be held by objects within the heap and cleaned by finalizers. Reduce the size of the heap and increase the frequency with which finalizers are run.

Copyright IBM Corp. 1997, 2003