// troubleshooting guide · jenkins

Jenkins java.lang.OutOfMemoryError: Java Heap Space

Status
Workaround available
platforms:
Jenkins controller (all OS)
updated:
November 16, 2026
reports:
4
Method
how we research
Share

RUNBOOK · jenkins/out-of-memory4 FIXES

// quick answer

The controller's Java heap is too small for its data or a plugin is leaking. Raise -Xmx, restart, and if it keeps happening capture a heap dump to find the leak.

Most likely fix: Increase the heap

How to fix it

// try these in order, the most common fix is first

  1. FIX 1Increase the heap

    1. 01Run sudo systemctl edit jenkins
    2. 02Add [Service] and Environment="JAVA_OPTS=-Xmx4g" (size to your RAM)
    3. 03On older Debian setups edit JAVA_ARGS in /etc/default/jenkins instead
    4. 04sudo systemctl daemon-reload && sudo systemctl restart jenkins
    Did this fix it?
  2. FIX 2Restart after any OOM

    1. 01After an OutOfMemoryError Jenkins is in an undefined state
    2. 02Restart the service rather than letting it limp on
    Did this fix it?
  3. FIX 3Capture a heap dump

    1. 01Add -XX:+HeapDumpOnOutOfMemoryError to JAVA_OPTS
    2. 02Analyse the dump to see which plugin or object holds memory
    3. 03Update or remove the offending plugin
    Did this fix it?
  4. FIX 4Reduce memory load

    1. 01Enable Discard old builds on jobs
    2. 02Remove unused plugins
    3. 03Move heavy report parsing to agents or trim report size
    Did this fix it?

SANDBOX · jenkins RUNS IN YOUR BROWSER

Try it: push, review, run CI and merge in a code host and cloud workspace

A hands-on Jenkins-style sandbox, including the spots where users get stuck. See where problems like this one start. 1-2 minutes, nothing is saved.

Symptoms

Jenkins becomes very slow, then logs java.lang.OutOfMemoryError: Java heap space or GC overhead limit exceeded; pages fail and builds hang until a restart.

Why it happens

  • C-01Jenkins data (jobs, build history) outgrew the default heap
  • C-02A temporary spike, e.g. parsing huge test reports
  • C-03A plugin leaking memory in the controller JVM
  • C-04Too many builds kept in history

// this guide also covers

  • jenkins out of memory
  • jenkins java heap space
  • jenkins gc overhead limit exceeded
  • jenkins increase heap size

Still not working?

If Jenkins keeps failing, you're not alone. See every Jenkins problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us

Watch Jenkins Get an email when its price changes, it has an outage, or we publish a new fix. No spam.

Fixed it? Share this guide

The same problem in other apps

All not loading, error messages & connection guides →

Other Jenkins errors

All 14 Jenkins errors and fixes →