You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Morten Matras <ko...@gmail.com> on 2008/01/11 09:34:26 UTC

memory usage increases on application stop

Case:

I've deployed an application on a Tomcat 6.0 (current release). The
application is a Hibernate / Stripes application.


Almost no memory is allocated due to the deployed application.


Setting:


-Xmx64m -XX:MaxPermSize=128m


Tomcat without application uses: 27,5M (real memory) and 349M (virtual
memory)
Tomcat with application uses: 133M (real memory) and 367M (Virtual memory)


Now if I stop this application (using the manager) the memory profile
becomes:


Tomcat with stopped application: 128M (real memory) and 679M (virtual
memory)


So stopping the application increases the virtual memory usage from 367 to
679 m and stays there!


Undeploying a stopped application doesn't change the numbers.


Why does stopping (or undeploying) a webapplication cause a dramatic
increase in memory usage?


My guesses:
 - Some ressources are not freed? (database connections)
 - Some hibernate related stuff are trapped in a circular relation circle?
 - Tomcat punishes me for stopping something it really liked :-)



-- 
  Morten Matras
  Udviklingschef
  GAMP Media og Blob Communication ApS
  Svendsagervej 42
  5240 Odense NØ
  Tlf: 61711103
  E: morten@gampmedia.dk

  T: 76 654321
  W: www.blobcom.com
  E: morten@blobcom.com

RE: memory usage increases on application stop

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: David Delbecq [mailto:delbd+jakarta@oma.be] 
> Subject: Re: memory usage increases on application stop
> 
> Note that the PermSize is taken from the heap, 
> so it should be lower than max heap size.

Not true in a HotSpot JVM; the heap and PermGen settings are
independent.  The virtual space for the heap and PermGen is allocated in
one chunk, using the total of the sizes.

 - 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: memory usage increases on application stop

Posted by David Delbecq <de...@oma.be>.
En l'instant précis du 11/01/08 09:34, Morten Matras s'exprimait en ces 
termes:
> Case:
>
> I've deployed an application on a Tomcat 6.0 (current release). The
> application is a Hibernate / Stripes application.
>
>
> Almost no memory is allocated due to the deployed application.
>
>
> Setting:
>
>
> -Xmx64m -XX:MaxPermSize=128m
>   
According to memory below, those settings are not take into account, or 
you wouldn't go over about 70M total space (java heap space of 64M max + 
jvm code of a few megs). Note that the PermSize is taken from the heap, 
so it should be lower than max heap size.
>
> Tomcat without application uses: 27,5M (real memory) and 349M (virtual
> memory)
> Tomcat with application uses: 133M (real memory) and 367M (Virtual memory)
>
>
> Now if I stop this application (using the manager) the memory profile
> becomes:
>
>
> Tomcat with stopped application: 128M (real memory) and 679M (virtual
> memory)
>
>
> So stopping the application increases the virtual memory usage from 367 to
> 679 m and stays there!
>   
The increase is probably due to specific code your application executes 
when it is stopped. It seems to do memory intesive things there :) You 
have to be aware a JVM memory never decrease in terms of system memory 
size. It can only grow up to the -Xmx size. (See sun's jvm docs for 
details). To get an idea of what memory size is really available for 
your jvm, you must check the values inside the jvm (use the system 
class, or a easy to use tool like lambda probe).

If, even after a GC, memory is not release inside the java heap, then go 
check for memory leaks in your webapp.

>
> Undeploying a stopped application doesn't change the numbers.
>
>
> Why does stopping (or undeploying) a webapplication cause a dramatic
> increase in memory usage?
>
>
> My guesses:
>  - Some ressources are not freed? (database connections)
>  - Some hibernate related stuff are trapped in a circular relation circle?
>  - Tomcat punishes me for stopping something it really liked :-)
>
>
>
>   


-- 
http://www.devlog.be (a belgian developer's logs)



---------------------------------------------------------------------
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