Receiving OutOfMemoryError exceptions
An OutOfMemoryError exception can result from running out of space on the Java™ heap or from running out of space in any of the MVS private areas.
If the Java heap is exhausted, an error message is received indicating an OutOfMemoryError condition with the Java heap. If the process address space (that is, the native heap) is exhausted, an error message is received that explains that a native allocation has failed. In either case, the problem might not be a memory leak, just that the steady state of memory use that is required is higher than that available. Therefore, the first step is to determine which heap is being exhausted and increase the size of that heap.
If the problem is occurring because of a real memory leak, increasing the heap size does not solve the problem, but does delay the onset of the OutOfMemoryError exception or error conditions. That delay can be helpful on production systems.
The maximum size of an object that can be allocated is limited only by available memory. The maximum number of array elements supported is 2^31 - 1, the maximum permitted by the Java Virtual Machine specification. In practice, you might not be able to allocate large arrays due to available memory. Configure the total amount of memory available for objects using the -Xmx command-line option.
If an out-of-memory exception occurs and no error message is produced, the Java heap is probably exhausted. To find the problem, you can try tracing or examining heap dumps. For more information, see Tracing leaks, or Using Heapdumps in the J9 VM reference.
Some BPXPRMxx settings, for example MAXTHREADS, can also cause OutOfMemoryError exceptions. For more information, see Configuring your system in the OpenJ9 user documentation.