Out of Memory Exception - Java Heap

Article ID:204529970
1 minute readKnowledge base

Issue

You see one of the following stacktraces on jenkins.log:

java.lang.OutOfMemoryError java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: GC Overhead limit exceeded

Resolution

1. Set right Heap Size

2. Tuning your Garbage Collector according to your Heap Size

Garbage collection (GC) is a dynamic approach to automatic memory management and heap allocation that processes and identifies dead memory blocks and reallocates storage for reuse.

As explained in Prepare CloudBees CI for Support > Java Parameters > Section II

3. Further diagnostics

If you continue to encounter issues even after the heap space increase and set correct GC settings, then we would need more diagnostic information to debug further. In order to investigate the cause of the Out of Memory Exception you will need to attach to the ticket:

This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.