Permanent Generation Memory Usage
Asked by Stephen Gurnick:

I am running Confluence 4.3.3 (java version "1.6.0_26") with the following JVM memory parameters:

-Xms256m -Xmx2048m -XX:MaxPermSize=256m

My System Information -\> Java JVM Memory Statistics typically looks like this:![](../../upfiles/confluence_java_jvm_memory.png)

I am satisfied (so far) with the Heap Size and overall system performance.

However, my concern is with the high usage of Permanent Generation Memory. I have not experiened any crashes or OutOfMemoryErrors (yet) and I'm hoping to keep it that way.

In reading knowledge base articles [here](https://confluence.atlassian.com/x/hICQBw) and [here](https://confluence.atlassian.com/x/1Si_EQ), (and other general JVM memory usage articles) I gained a basic understanding of how PermGen memory is used (for loaded class files) and sometimes associated with plug-ins. I do not believe I'm using an inordinate number of plug-ins.

I have not been able to find a way to determine why the PermGen memory usage is so high and almost at its limit.

Are there any procedures available that I can use to find out what is the cause of such high PermGen usage? Are there strategies specifically for tuning the allocation of PermGen memory? Could this be a garbage collection issue?

Thank you for your help pointing me in the right direction.


Answers:
author: Stephen Gurnick
body: To remedy my issue of almost running out of PermGen memory in my Confluence instance, I increased it from the default 256MB to 512MB in setenv.sh

```
-XX:MaxPermSize=512m
```

Also I set the heap memory min and max value to 2048MB

```
-Xms2048m -Xmx2048m
```

Setting this to the same value is based on the recommendation from [here](https://confluence.atlassian.com/x/1Si_EQ).


author: Fabio Racobaldo _Herzum_
body: Hello Stephen,

you can install [](https://marketplace.atlassian.com/plugins/net.bull.javamelody)<https://marketplace.atlassian.com/plugins/net.bull.javamelody>plugin. Btw, I suggest you to increase your perm gem memory just editing JIRA-INST/bin/setenv.sh file.

Hope this helps,

Fabio

comments: author: Stephen Gurnick
body: Thank you, Fabio, for this plug-in suggestion. I'll take a look at it.

With regard to increasing the PermGen allocation, I'm aware of the procedure for doing that, however I'd like to understand why so much is being used so that I can increase it to the appropriate level - if necessary. I imagine that if there is some issue our system is experiencing (e.g. garbage collection issue) then increasing it may simply mask the issue for a short time until I'm in the same situation agian.

Are there methods to determining what is being stored in PermGen and if it is being cleaned-up appropriately? I understand the situation may be that everything is working fine and I just need to increase the memory, but at this point I have no way of determining that.

Thanks again.


author: Fabio Racobaldo _Herzum_
body: Hi Stephen,

The most common is that the addition of more plugins contributes to more consumption of PermGen space. The error occurs when enough classes are invoked. Moreover, if you use scripts into your JIRA instance they could affect PermGem space.

It could also happen if you try and run multiple Atlassian applications in a single Tomcat container.

Hope this helps,

Fabio


author: Stephen Gurnick
body: Fabio,

This is with regard to my Confluence system, not JIRA, however I imagine with respect to PermGen memory usage there shouldn't be too much of a difference.

I haven't experienced any errors yet and I'm looking for ways to prevent any issues, especially since I'm so close to the memory threshold.

Thank you for your suggestions, but unfortunately they don't seem to apply to my Conlfuence environment.


Tags: confluence-administration