开发者

How can I view the MaxPermSize in JVM?

开发者 https://www.devze.com 2023-02-14 07:27 出处:网络
I\'m meeting the dreadful PermGen:Out of memory error when deploying a web-app on TomCat. I have tried many possible solutions, but they don\'t work out(sometimes it works, usual开发者_运维百科ly it d

I'm meeting the dreadful PermGen:Out of memory error when deploying a web-app on TomCat. I have tried many possible solutions, but they don't work out(sometimes it works, usual开发者_运维百科ly it doesn't). I wonder if my config in "BuildConfig.groovy" take effect:

grails.tomcat.jvmArgs = ["-Xmx1024m", "-XX:MaxPermSize=1024m"]

Does anyone know someway to view the MaxPermSize actually applied by the JVM?


In direct answer to your question, java.lang.management.ManagementFactory has method to get information on all of the memory pools used by java, including the PermGen space and other non-heap memory pools:

List<MemoryPoolMXBean> memoryPoolMXBeans = java.lang.management.ManagementFactory.getMemoryPoolMXBeans();

for (MemoryPoolMXBean bean : memoryPoolMXBeans) {
    //Iterate over pools here
}


You can use JVisualVM in the JDK/bin directory to monitor everything about a java process.


There's a couple of utilities that come in the jsdk i believe - try jstat -gcpermcapacity. Another trick that can sometimes be helpful is ps -fwwwC java (assuming you are running this on a linux box)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号