-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Brian,
On 11/11/2010 1:54 PM, Brian wrote: > I don't think my app is taking all this RAM, because when I restart it, the > RAM usage doesn't go down. That doesn't necessarily mean that your webapp isn't using all that heap space: it's very easy for a webapp to do something foolish and cause all of it's used memory to stay active even after a webapp restart. I disagree with Ben's comment about database connections: there are faster ways to bust your heap than leaking database connections. If you /are/ using Tomcat's container-managed DataSource (which I highly recommend), you should enable all of the abandoned resource tracking features to help fix any resource leaks that you may have there. I agree with Chuck's assessment, but there may be some questions we can ask to help lead you down the right path when using tools such as memory profilers. 0. What kind of OOME are you suffering? Please post any messages that you get when your heap busts. Specifically, is this a "regular" heap exhaustion or a PermGen exhaustion? 1. Are you seeing any messages in catalina.out when you undeploy of the form "your webapp likely has a memory leak"? Tomcat 6.0.x has some nice checks on undeploy to see if your webapp is leaking some specific things like threads, etc. 2. Are you re-starting your webapp a lot while Tomcat remains running? Failure to perform some clean-up during webapp unload can cause your entire set of classes loaded in the "old" webapp to stay in the PermGen space forever. 3. Are you using any caching mechanism in your webapp? Perhaps it needs to be tuned. You should probably check out what's in your "application" scope: you may have things you didn't expect. 4. Are you using HttpSession for anything bulky? It's possible that you are "leaking" memory with lots of sessions. When a webapp is stopped, though, all session should be purged and if you have session persistence, they should all come back and take up the same amount of memory. This is a long-shot, but low-hanging fruit. You can get a lot of mileage out of a tool like "jmap" which comes with the JDK (and JRE?): you can get a heap histogram and look at things that are taking up a lot of space. If you find that you have several tens of megabytes of foo.bar.Baz classes, then you can look at your app to see where you heavy uses of those classes are. To understand #2 a bit better, see Mark's presentation from this year's ApacheCon NA: http://people.apache.org/~markt/presentations/2010-11-04-Memory-Leaks-60mins.pdf It's worth a read to understand how simple things like using a logging library can cause PermGen exhaustion after several webapp redeploy operations. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkzcRjgACgkQ9CaO5/Lv0PCslgCgs6mzKt5iVkEcid2cel0G5YCn IFgAn23tJppaq7lbmve5ce2laL2exkV3 =+KOk -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org