Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Troubleshooting Grails/Groovy memory leaks?

I've got a Grails application that does a fairly decent amount of domain object creation and destruction, and it seems to run out of PermGen space at a very, very rapid rate. I've done the usual tweaks (bumped PermGen to 256M, enabled class GC, etc.), but no dice.

Would anyone care to recommend some (and hopefully free or very low-cost) tools for troubleshooting this sort of memory consumption in Groovy and/or Java? Or some techniques that you use to troubleshoot JVM memory problems?

Edit: This is when the application is deployed inside Tomcat in production mode; I've not tried with other containers. Even so, it would be nice to have some resources for tracking down the problem.

like image 812
Don Werve Avatar asked Apr 03 '09 00:04

Don Werve


2 Answers

Have you tried

-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled

?

Together with increasing the usual suspects (-Xmx, -Xms, -XX:PermSize and -XX:MaxPermSize) this resolved all the PermGen issues on our production Tomcat, which had occured pretty soon after deploying the app. Never seen another OOM-Exception after that. :-)

like image 78
Daniel Rinser Avatar answered Sep 30 '22 12:09

Daniel Rinser


I personally like VisualVM. There are definitely more powerful tools around, but this one has got a nice usability-to-power ratio.

like image 22
Joachim Sauer Avatar answered Sep 30 '22 10:09

Joachim Sauer