On Mar 26, 2014, at 4:23 PM, Felipe Jaekel fkjae...@gmail.com wrote:
I have configured my Tomcat 7 with the following parameters:
-Xms4G -Xmx4G -XX:MaxPermSize=256m -XX:+UseTLAB -XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled -Dorg.apache.el.parser.COERCE_TO_ZERO=false
I've seen in several blogs and StackOverflow posts
that CMSClassUnloadingEnabled should sweep PermGen too, but checking in the
manager application after some undeployments, the PermGen value never
decreases.
Am I missing something? I'm using OpenJDK 7 update 51 64-bit.
Thanks
Felipe, I spent a lot of time recently troubleshooting this. Here are my
observations:
-XX:+UseConcMarkSweepGC
This is not necessary. The CMSClassUnloadingEnabled is sufficient.
You won't notice PermGen space decrease unless you actually hit the memory
ceiling, and then the garbage collector will kick in.
There are numerous things that hold soft references to your classes. That's why
the PermGen space won't decrease. In addition, Tomcat will incorrectly report
memory leaks, because your classes and classloader will be still resident in
memory until the GC forces the soft references to release.
You must use a profiler (I use YourKit) to really know whether anything is
holding hard references to your classes. I found several things that were
holding hard references to my classes or threads launched in my applications:
* RMI (this was really a pain in the ass to fix, and required a lot of
reflective field access to low level JDK stuff). It is very, very difficult to
un-export RMI objects cleanly.
* Keep-Alive thread, if your web app is initiating HTTP connections
* MySQL JDBC driver (not a concern if you load that at the container level, but
if you load it inside your webapp, you need to call a static method
AbandonedConnectionCleanupThread.shutdown();
Once I fixed these things, I am able to repeatedly reload my application in the
Tomcat manager without running out of memory in the PermGenSpace.
--Jesse Barnum, President, 360Works
http://www.360works.com
Product updates and news on http://facebook.com/360Works
(770) 234-9293
== Don't lose your data! http://360works.com/safetynet/ for FileMaker Server ==
-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org