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 17:25:04 GMT
Not much clearer, but I'll try to explain a bit more ;)

>I have to specify that the servlet is done! And the next time the
>servlet is run (another tomcat thread) the memory usage starts at the

It may not be another tomcat thread.  And conversely, it may be a
different (possibly new) instance of your servlet.  Does your servlet
implement SingleThreadModel?

>percentage used by the former run. Say, if I want a report and that
>takes up about 50% of memory, and then you want the same. Then you will
>take the memory up to 100%, because tomcat still holds 50% from my run,
>even though it has terminated!

Keep in mind a couple of things:

The amount of allocated memory always increases until it's garbage
collection.  So if you have a run of your servlet, allocating some
memory, and hold on to those objects, they won't be garbage collected.
Then on the next run of your servlet, the VM has no choice but to
allocate more memory.

Tomcat doesn't hold on to these objects.  Make sure nothing in your code
does either.   That way they will be garbage collected.

Have you tried any of the other garbage collection tuning parameters
mentioned in my previous message?   It's worth trying a few runs,
recording your results, and analyzing them.  You can get vastly
different memory profiles with the Java runtime options previously

Yoav Shapira
Millennium ChemInformatics

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

View raw message