users@glassfish.java.net

Re: Autodeploying multiple times causes OutOfMemoryError in PermGen

From: <glassfish_at_javadesktop.org>
Date: Thu, 08 Mar 2007 23:04:20 PST

> After about 20 deployments my glassfish has grown
> about 400MB in size and the classloader is managing
> about 50,000 classes (up from about 7,000-10,000) on
> first deployment.

We are having the same situation, with Win XP SP2 + JDK 6.0 + OpenJPA.


> Is the classloader failing to
> release classes from the previous deployment?

I suspect so, too.


I did an experiment, and, for your information, I attached the result as follows...

- I used an EAR contains session beans, JPA entities, Java Web Start application client. Its size is about 2M bytes after compression. Open JPA is not in the EAR; it is placed in 'lib' directory of the GF domain.

- I auto-deployed and auto-undeployed the EAR six times, and recorded memory usage and the number of classes.

- With every deployment, the number of classes loaded increased about 300, and PermGen usage increased about 1.2M.

- With every un-deployment, the number of classes loaded increased about 10 or 20, and PermGen usage increased about 40K.

- Classes were never unloaded during the experiment except two cases. In one case, about 250 classes were unloaded. In another case, about 1500 classes were unloaded. It took about 30 minutes between the two cases. After the second case, the number of classes loaded was still larger than that in the beginning.

- PermGen usage never decreased, even when 15 minutes passed after the 1500 classes were unloaded.


Hope it helps.
- Ryosuke
[Message sent by forum member 'isana' (isana)]

http://forums.java.net/jive/thread.jspa?messageID=207058