Can someone explain a little bit about classloading really quick?

Let me preface this with: I am maintaining an application which I did
not develop.

Looking at the WEB-INF/lib directory, it has around 76 different jar
files, some actually used in the application, some (well, most) not.
They either pertain to legacy features or are functionality duplicate
(two different versions of Oracle driver libraries, for example)

I am trying to tune Tomcat because it keeps running out PermGen space,
so I am using jconsole to inspect the JVM.  I suppose it isn't really
a profiler, but it is a start.

According to jconsole, after doing many application development cycles
of remove->deployment of *.war to Tomcat (via manager), it looks like
as many as 20k classes are loaded.  I was under the impression that
the garbage collector would unload classes as necessary.

I tried to force a GC via jconsole, it reduced the heap memory like it
should, and it unloaded a few classes pertaining to reflection, but
nothing like what I was hoping for.  I then leave it be for several
hours, and all magic like, the GC unloads about 4k classes.

First question.   Anyone tell me why it doesn't unload classes when I
am trying to force it?  Is classloading/unloading not even the same as
garbage collection?

Second question.  Is having 20k classes loaded normal for a middle
sized application?  I am assuming if I remove all the unnecessary jars
from WEB-iNF/lib I can reduce that number?  Would it benefit anything
to place them in shared/lib?

Third:  If over 75% of the classes in the jars aren't being called
anywhere in the application, even though they get loaded on the
initial application deployment, shouldn't the GC unload them almost
immediately, since there aren't any open resources using these
classes.

Fourth question:  Do my JAVA_OPTS looks decent?

JAVA_OPTS="-Xms512m -Xmx512m -server
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8114
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-verbose:gc
-XX:+PrintClassHistogram
-XX:+PrintGCDetails
-XX:MaxPermSize=128m"

many thanks!

-- brian

ps.  My platform looks like:  Solaris 9 (SPARC), Tomcat 5.5.23, JDK
1.6.0_02 (32-bit)

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