// 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
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
FIX 1Increase the heap
- 01Run sudo systemctl edit jenkins
- 02Add [Service] and Environment="JAVA_OPTS=-Xmx4g" (size to your RAM)
- 03On older Debian setups edit JAVA_ARGS in /etc/default/jenkins instead
- 04sudo systemctl daemon-reload && sudo systemctl restart jenkins
Did this fix it?FIX 2Restart after any OOM
- 01After an OutOfMemoryError Jenkins is in an undefined state
- 02Restart the service rather than letting it limp on
Did this fix it?FIX 3Capture a heap dump
- 01Add -XX:+HeapDumpOnOutOfMemoryError to JAVA_OPTS
- 02Analyse the dump to see which plugin or object holds memory
- 03Update or remove the offending plugin
Did this fix it?FIX 4Reduce memory load
- 01Enable Discard old builds on jobs
- 02Remove unused plugins
- 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 usThe same problem in other apps
Other Jenkins errors
- Jenkins Build Stuck 'Waiting for Next Available Executor'
- Jenkins Build Stuck and Won't Abort
- Jenkins Plugins Failed to Load After Update
- Jenkins Not Starting: 'Job for jenkins.service failed'
- Why Is Jenkins So Slow?
- Jenkins 'Scripts Not Permitted to Use Method' Error
- Jenkins GitHub Webhook Not Triggering Build
- Jenkins Git 'Failed to Connect to Repository' Status Code 128