I'm running Tomcat 5.5.23 on Java 1.6.0_01 on Windows. During testing I've
noticed that memory usage rises steadily with each redeploy of an
application.  After each redeploy Jconsole reports the number of loaded
classes has risen and the memory use in the PermGen has increased.  Tomcat
is the binary build of core from the Apache site.  I've added no libraries
in any of the shared lib directories.  The application war that I'm
deploying contains amoung other things log4j, commons logging and Hibernate.


Thinking I had a memory leak I used jmap to take a heap dump and then
reviewed it using jhat.  I have found a couple of problems which I resolved
by updating some libraries but I'm stuck with one remaining issue.  At least
sometimes the WebappClassLoader for the application is not being garbage
collected because of a static reference from a tomcat class to Webapp loaded
class.  I see these references coming from
org.apache.jasper.runtime.PageContextImpl, class
org.apache.tomcat.util.http.ServerCookie and others.  I've included a
portion of the jhat report below.  It seems these and other classes have a
static variable referencing a log and that this static is somehow getting
initiailzed to the commons logging loaded by the webapp classloader.  Is
there some way to prevent this?



Static reference from javax.servlet.jsp.JspFactory.deflt (from class
javax.servlet.jsp.JspFactory) <http://localhost:7000/object/0x1c234890>  :

--> [EMAIL PROTECTED] (16 bytes)
<http://localhost:7000/object/0x064754e0>  (field pool:)
--> [EMAIL PROTECTED] (24 bytes)
<http://localhost:7000/object/0x064a10d8>  (field pool:)
--> [Ljava.lang.Object;@0x64bbed0 (408 bytes)
<http://localhost:7000/object/0x064bbed0>  (Element 0 of
[Ljava.lang.Object;@0x64bbed0:)
--> [EMAIL PROTECTED] (65 bytes)
<http://localhost:7000/object/0x06d3b2c0>  (field log:)
--> [EMAIL PROTECTED] (16 bytes)
<http://localhost:7000/object/0x06d75998>  (??:)
--> class org.apache.commons.logging.impl.Log4JLogger (84 bytes)
<http://localhost:7000/object/0x1cb04b78>  (??:)
--> [EMAIL PROTECTED] (152 bytes)
<http://localhost:7000/object/0x06b56fa0>  


Static reference from
org.apache.tomcat.util.IntrospectionUtils.class$org$apache$tomcat$util$Intro
spectionUtils (from class org.apache.tomcat.util.IntrospectionUtils)
<http://localhost:7000/object/0x1bf86860>  :

--> class org.apache.tomcat.util.IntrospectionUtils (84 bytes)
<http://localhost:7000/object/0x1bf86860>  (??:)
--> [EMAIL PROTECTED] (63 bytes)
<http://localhost:7000/object/0x06471120>  (field classes:)
--> [EMAIL PROTECTED] (24 bytes)
<http://localhost:7000/object/0x0649ac10>  (field elementData:)
--> [Ljava.lang.Object;@0x64b4fb0 (1288 bytes)
<http://localhost:7000/object/0x064b4fb0>  (Element 220 of
[Ljava.lang.Object;@0x64b4fb0:)
--> class org.apache.tomcat.util.http.ServerCookie (84 bytes)
<http://localhost:7000/object/0x1c27b348>  (static field log:)
--> [EMAIL PROTECTED] (16 bytes)
<http://localhost:7000/object/0x06b5a688>  (??:)
--> class org.apache.commons.logging.impl.Log4JLogger (84 bytes)
<http://localhost:7000/object/0x1cb04b78>  (??:)
--> [EMAIL PROTECTED] (152 bytes)
<http://localhost:7000/object/0x06b56fa0>  


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

Reply via email to