Thanks a lot Joe, we are checking our code based on your suggestions.

Cheers,
Greg




________________________________
From: Joseph Morgan <joseph.mor...@ignitesales.com>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Tue, January 12, 2010 11:15:54 PM
Subject: RE: Tips on tracking down memory leaks

Greg, you've just awakened a 900 lb gorilla!

My guess, based upon your description of the problem as large chunks at
a time, is something related to reading and caching data, and this is
why PMD and profiling tools won't help. 

Therefore, look at all the code accessing data from whatever storage you
use (DB, File?), and find out where that data flows.  I'd also guess is
that someone is storing data in the context, maybe as a cache, or just
because they don't know any better. So search for "setAttribute" calls
in the code and trace the associated object.  If that object points to
the servlet context, then mark it as a candidate.  This could be
complicated by JSPs (if you are using them), because they could be
storing data within the application scope within JSP pages (very bad
practice, but very widely used).  Also check out tag libraries, because
it can be done there too.

Check your session timeout to make sure it isn't too high (however, you
did say it isn't slow growth, but check anyway).

However, we could literally guess all day long, as there are dozens of
ways code can eat up memory.

Joe

-----Original Message-----
From: Greg McCane [mailto:gregmcc...@yahoo.ca] 
Sent: Monday, January 11, 2010 8:33 PM
To: users@tomcat.apache.org
Subject: Tips on tracking down memory leaks

Hi Everyone,

I am running tomcat 5.5 on Debian Linux (uname says Linux
2.6.26-2-amd64, /etc/debian_version says 5.0.2). The JVM version is
1.5.0_14-b03.

We have 9 servlets running.

The tomcat process itself is managed by monit.

We see tomcat memory usage growing over time and have set monit to
automatically restart it (using the /etc/init.d/tomcat5.5 startup
script) when memory usage reaches 2.8 GB. It takes about 20 hours to get
to this point. This is an attempt to avoid a tomcat crash/hang resulting
in an outage for our users. The memory growth appears to be in large
chunks rather than slow, steady growth.

We have turned on incremental garbage collection with the following
options:

"-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode 
-XX:+CMSIncrementalPacing -XX:CMSIncrementalDutyCycleMin=0 
-XX:+CMSIncrementalDutyCycle=10 -XX:-TraceClassUnloading
-XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled"

The JVM heap size is set with: "-Xmx3072M -Xms1024M "

We have checked our code using pmd and have profiled it using TPT and
Eclipse in our development environment. We have made improvements as a
result of the findings from these tools, but we are still having
problems.

Any suggestions for next steps to help us get to the root cause of this
problem?

Thanks,
Greg


      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


      __________________________________________________________________
Be smarter than spam. See how smart SpamGuard is at giving junk email the boot 
with the All-new Yahoo! Mail.  Click on Options in Mail and switch to New Mail 
today or register for free at http://mail.yahoo.ca

Reply via email to