Out of Memory Exception - Java Heap


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

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



1. Set right Heap Size

As explained in Java Heap settings best practice

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 Jenkins 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:

Have more questions?


  • 0
    Ravi Tirumalasetty

    This link is not working Java Heap settings best practice

  • 0
    Denys Digtiar

    Thank you for letting us know, Ravi! It has now been fixed.

Please sign in to leave a comment.