Let's debug a running Java VM with jconsole
My jvm's are running out of permgen -memory! Why is that, I wonder to myself. And how much is it using? Time to take out the jconsole.
Because its an app running inside a Tomcat, this requires that tomcat startup VM arguments include
-Dcom.sun.management.jmxremote
Since I am testing locally, this should be all that is needed. In fact, I'm not 100% sold if thats actually even required. ;) If this was a remote, then hostname and port and other connection parameters would be required.
Once the JMX conf is set up, start jconsole from the command line. You will need a jdk thats in your path.
jconsole
A window should popup, and java mascot should ask you to choose the process that you wish to debug. Choose the process, and you can start by choosing "Memory" -tab, and Memory Pool "Perm Gen" from the pulldown - given you are also interested in what causes Permgen to cap!