PermGen space – How To Fix ?

java.lang.OutOfMemoryError: PermGen space

If you get the error message: java.lang.OutOfMemoryError: PermGen space this means that you have exceeded Java’s default 64Mb block for loading class files. This can happen if many plugins are installed. You may want to increase the PermGen memory size to suit your needs.
In the following sample, the blue parameter shows how the PermGen Memory has been set to 192 megabytes. This value should be set depending on your memory requirements. 192m should be sufficient for Confluence even when many plugins are installed.

JAVA_OPTS="-Xms128m -Xmx1024m -XX:MaxPermSize=192m $JAVA_OPTS -Djava.awt.headless=true "

Note: The other parameters in this sample are just shown to give you some context, and are not part of this example.

java.lang.OutOfMemoryError: Java Heap Space

Heap space memory errors occur when the application has to deal with large amounts of data or users. These errors will contain only a java.lang.OutOfMemoryError, e.g. without the reference to PermGen space as above. You should try to increase the heap size to solve this problem. This requires configuring the Xmx and Xms parameters. In the following example, the maximum heap size is set to 1024 megabytes. This should be enough for small to medium deployments.

JAVA_OPTS="-Xms128m -Xmx1024m -XX:MaxPermSize=256m $JAVA_OPTS -Djava.awt.headless=true "

Note: The other parameters are only shown to give you context and are not part of this example.

Deployments with high usage patterns may require additional memory. For high-usage deployments, it is recommended to set both Xms and Xmx as the same value (eg. -Xms1024m -Xmx1024m), provided the memory is available. On the other hand, adding too much memory can also cause problems (see below), so you should increment memory carefully, for example in increments of 128 megabytes.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s