Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've run load against my web application for the past few days, and I've noticed that "Current Classes Loaded" viewed via JMX monitoring is continually increasing. It will go up and then back down, but the average amount of classes loaded is increasing linearly with time. At the beginning of load, "Current Classes Loaded" was only a few thousand. Now, however, "Current Classes Loaded" has reached 130,000+.

Is this normal? I know that classes will fill up PermGen memory, but it's not definitive whether or not PermGen memory is leaking.

    65,124 kbytes
    65,536 kbytes
    65,536 kbytes

The used number moves between 62k and 65k, but I haven't noticed any catastrophic failure yet on the server. My question, then, is twofold.

First, is this normal? If it isn't, will this eventually cause Tomcat to crash?

share|improve this question
up vote 1 down vote accepted

i'm afraid there is no clear answer to your question. the most space in the permgen should be occupied by the classes of your application. it is possible your application is generating classes while it is running. then the described behaviour of your application is as expected. when your application is not generating classes on the fly, the number of loaded classes and amount of permgen should be more or less static.

when your application is creating to much classes you can get memory problems. you will then see java.lang.OutOfMemoryError: PermGen space messages in the tomcat log. you can test this by setting the perm gen explicitly with this parameter: -XX:MaxPermSize=.

you can also try this parameter: -XX:+CMSClassUnloadingEnabled with the cms garbage collector. when the number of loaded classes does not go down, you still have references from objects to these classes. this could be a sign you really have a memory leak. but you definitely have to know the running application to be sure. when this is the desired behavior of the application you can only increase the space for the perm gen. the size of the perm gen is additional to the size of the heap.

here is a posting on stackoverflow which suggests a method to make clear what is the content of the permgen.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.