Fix “java.lang.OutOfMemoryError: Java heap space” for Jenkins

Increasing Java heap size for Jenkins on a Debian server. 

Here’s the error we got:

SEVERE: Timer task [email protected] failed
java.lang.OutOfMemoryError: Java heap space

To fix this, open Jenkins configuration file /etc/default/jenkins and change the JAVA_ARGS value appropriately:


Don’t forget to restart the service:

# /etc/init.d/jenkins restart

Check logs in case of problems:

# tail -f /var/log/jenkins/jenkins.log