tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: OutOfMemoryError - Excessive class loading
Date Thu, 01 Apr 2004 14:09:52 GMT

Hi,

>When a context is stopped, does all the resources will be released?
This
>includes stopping of threads
>if any and unloading of all classes which are loaded during the context
>lifecycle.

No, some resources such as the classloader itself may be retained in
memory.  A new one will be provided for your app with new copies of your
classes, that's why you're seeing multiple definitions.  You can do
things to help this, such as cleaning up all your references when the
webapp is destroyed (a ServletContextListener's contextDestroyed and the
Servlet#destroy methods are good places for this), including logging
services, background threads, and the like.

If you don't clean up, each webapp reload will consume more memory,
including in the heap's permanent generation, eventually resulting in
OutOfMemoryErrors.  This is why most people don't reload webapps in
production, or if they do they also restart the server periodically.

Of course, all of this (and more specific details) has been discussed
numerous times on this list, and is therefore available in the archives,
but I've given up on hoping people would research before posting
questions.

Yoav Shapira




This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message