Why do I receive java.lang.OutOfMemoryError: PermGen space

Article ID:204264000
1 minute readKnowledge base


  • Get in Jenkins a stacktrace which says java.lang.OutOfMemoryError: PermGen space.

  • How to configure the windows agents java heap settings

  • PermGen Space issue while deploying CloudBees Jenkins Operations Center


You might need to increase the PermGen in case you have a value under 512m, which should be enough.

They way you can modify this value depends on the distribution and depending on the agent type


  • In RedHat, for example, you can do it under /etc/sysconfig/jenkins using the variable JENKINS_JAVA_OPTIONS…​ i.e JENKINS_JAVA_OPTIONS="-XX:MaxPermSize=512m".

  • In Ubuntu, the Jenkins configuration file is under /etc/default/jenkins and the variable to configure is JAVA_ARGS …​ i.e JAVA_ARGS="-XX:MaxPermSize=512m".


Sometimes agent machines will require permgen to be increased. Depending on the type of agent that is configured will require a different method for setting any java argument.

  • With SSH Agents, the java process is started using an SSH command, so the "-XX:MaxPermSize=512m" can be set in the JVM Options in the Node configuration page.

  • With JNLP Agents launching as a service on linux, you can add the VM arguments to the startup scripts (usually in /etc/sysconfig/jenkins or /etc/default/jenkins as part of the JAVA_ARGS variable)

  • With JNLP Agents launching as a service on Windows requires modifications to be made on the jenkins.xml file which is located on agent machine in the JENKINS_HOME directory.