Permgen Notes

I do development using Liferay on a JBoss server. For a while, I was having a lot of problems with permgen errors from the JVM. Basically, the server would crash, which made development pretty frustrating.

The two articles I found most useful were:

The default configuration for JBoss in MyEclipse is:

    -Xms1024m -Xmx1024m -XX:PermSize=128m

Based on the articles above, I tried setting a few different flags. I also played with the configured perm size, which required some experimentation. Basically, the perm size values below are the largest values for which Java will actually start on my machine with Eclipse already running. (In this configuration, Task Manager shows approximately 2.4 GB of memory in use when JBoss is booted, and 1.04 GB when only Eclipse is running.)

    -Xms1024m -Xmx1024m -XX:PermSize=205m
    -XX:+UseConcMarkSweepGC 
    -XX:+CMSPermGenSweepingEnabled
    -XX:+CMSClassUnloadingEnabled
    -XX:MaxPermSize=205m

Then, I did some experimenting. I booted JBoss, deployed my ear, exercised it with a simple search, closed IE and immediately redeployed the ear. I repeated this process as many times as possible.

With the old settings, I got a failure on the second re-deploy of the ear (i.e. the third total time the ear had been booted), which is consistent with what I had been seeing all afternoon. With the new settings, I was able to repeat the process many more times.

I'm not sure which of the new setting(s) made the difference and I don't have the time right now to really confirm that. However, for me it seems worth it to keep the changes in there since I should be able to work quite a bit longer without having to reboot the application server.

PermgenNotes (last edited 2008-07-09 06:21:26 by localhost)