HernĂ¢ni Cerqueira wrote:
> Hello all,
>
> I have a little curiosity, that may seem trivial for some of you. I
> usually do my work on linux, but sometime I work on a laptop that runs
> windows, and because i do lots of application reloads using tomcat
> manager, i usually ran out of memory, and then it comes the PermGem
> space exception. Then i have to go to task manager and kill the tomcat
> process because it wont even stop using regular ways, and restart
> again. But the strange is that sometimes i got a tomcat5 and a
> tomcat5w process using the memory, and some other times i got a javaw
> process. Can anyone tell me why this happens? It's not a annoying
> problem, is just a bit strange for me...
>
> Cheer's,
> HernĂ¢ni
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Well, here is a theory:
Reloading an app leads to creating a new class loader to load all of the
application classes. The old class loader is still there it is just not
used. However, the old class loader takes space. Therefore each app
reload just create more garbage in PermGen space. Now, as far as I know
(I can be mistaken), the garbage collection of PermGen is turned off by
default. Even more, no garbage collection of PermGen is implemented in
JDK 4 and lower. This is no problem in production systems since you
don't reload your app very often. (It is however a problem for platfrom
such as OSGi). However, if you are running on JDK 5 and better you can
do this:

-XX:PermSize=64m
-XX:MaxPermSize=160m
-XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled


First, you increase your PermGen memory pool to 64m (not sure what is
the default but it is quite small), which will not resolve the problem,
rather postpone it . But second and most important you are enabling the
PermGen garbage collection and that should resolve your problem.

I have discovered these JVM options just recently fighting a very
similar problem with my Eclipse IDE. I think the Exadel CTO blog about
this awhile ago (not sure). These options are really deeply hidden and
not quite well known. I found the example in the NetBeans configuration
file. I am currently not working on web app so I can try it myself. But
give it a try and see what happens

Cheers,
Stefan Baramov


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to