tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: Release of memory
Date Thu, 02 Jan 2003 16:12:44 GMT

>Can anyone tell me how to make tomcat release memory after a servlet is

You can't.

>finished? Now tomcat simply hold it and sooner or later my server
>to swap processes because of it. It does so even if I force GC at the

You can't force GC.  System.gc() is only a suggestion to the collector
and may be completely ignored.

>end of the servlet. If it is left idle, it frees some over time, but it
>takes to long.

What you can do:

- Allocate more memory to the heap, using the Java -Xmx parameter.
- Better tune your memory profile by changing the ratio of new
generation to old generation.  Sounds like you're 90% new generation.
See the -XX:MaxNewSize, -XX:NewSize (for JDK 1.3 and before) and also
-XX:NewRatio parameter for JDK 1.4 and later.
- Use a different, e.g. incremental (-Xincgc) or concurrent (on JDK 1.4
and later, -Xconcgc) garbage collector.
- Ensure you don't keep references to object you don't need.  If you
keep strong references, the collecto won't deallocate these objects.

Yoav Shapira
Millennium ChemInformatics

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message