You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hernâni Cerqueira <hr...@gmail.com> on 2007/03/08 06:10:37 UTC

Tomcat process on windows

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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat process on windows

Posted by Hernâni Cerqueira <hr...@gmail.com>.
Caldarale, Charles R escreveu:
> As far as I can tell, it is not used by any of the standard Tomcat scripts.
>   
Someone uses it ;-) ... But that isn't a problem. Thanks for a good 
ansewr to a silly question.

Hernâni

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


RE: Tomcat process on windows

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Hernâni Cerqueira [mailto:hrcerqueira@gmail.com] 
> Subject: Tomcat process on windows
> 
> 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. 

The tomcat5 process is Tomcat running as a Windows service.

The tomcat5w process is the Tomcat service manager program, not Tomcat itself.

A javaw process is a special Windows-only launcher that does not create a command prompt window for the target Java application; it's intended primarily for GUI apps.  As far as I can tell, it is not used by any of the standard Tomcat scripts.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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


RE: Tomcat process on windows

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Stefan Baramov [mailto:stefan_bar@bellsouth.net] 
> Subject: Re: Tomcat process on windows
> 
> 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.

The old class loader will be discarded if the app is implemented
properly.  Read the FAQ:
http://tomcat.apache.org/faq/memory.html
and especially this article:
http://opensource.atlassian.com/confluence/spring/pages/viewpage.action?
pageId=2669

> Now, as far as I know (I can be mistaken), the garbage
> collection of PermGen is turned off by default.

You are mistaken.  It's never been off by default in any release of a
Sun JVM since at least 1.2.

> Even more, no garbage collection of PermGen is implemented in
> JDK 4 and lower.

That is totally incorrect.  (BTW, there was no PermGen until JRE 1.4 was
released, other than a prototype 1.3 HotSpot that was not generally
available.)

In a HotSpot-based JVM (Sun 1.4 and above), PermGen is only collected
during a full GC, which is avoided as much as possible.  However, a full
GC is always done before returning an OOME for a potentially satisfiable
allocation request.

> -XX:PermSize=64m
> -XX:MaxPermSize=160m

Better to make PermSize and MaxPermSize the same, and 160m is probably
too small for any serious work.  There are lots of temporary classes and
interned String objects created by most app servers, and an
insufficiently sized PermGen will result in more frequent full GCs and
associated application pauses.

> -XX:+CMSClassUnloadingEnabled
> -XX:+CMSPermGenSweepingEnabled

The above only apply when Concurrent Mark-Sweep garbage collection is
enabled, which it is not by default.

This is a good introduction to HotSpot GC:
http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

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


Re: Tomcat process on windows

Posted by Stefan Baramov <st...@bellsouth.net>.
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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org