简体   繁体   English

eclipse下tomcat中的堆/ PermGen设置问题

[英]Heap/ PermGen setting issues in tomcat under eclipse

A colleague has the following setting in Eclipse / Tomcat run parameters, and complains of out of heap memory all the time: 一位同事在Eclipse / Tomcat运行参数中具有以下设置,并且一直抱怨堆内存不足:

-XX:PermSize=512M
-XX:MaxPermSize=1024M
-Xmx1024m

If I understand this correctly, both the max PermGen and max Heap are each 1 GB. 如果我正确理解这一点,则max PermGenmax Heap均为1 GB。 Since PermGen is a special part of the Heap, this amounts to allocating all of the heap to PermGen . 由于PermGen是Heap的特殊部分,因此相当于将所有堆分配给PermGen Is this correct? 这个对吗?

Per Perm Space vs Heap Space , I might be correct. Per Perm Space vs Heap Space ,我可能是正确的。 Would this be causing the issue? 这会引起问题吗?

Per Is Java PermGen Space Part of Total VM Memory , my understanding is not correct. Per Is Java PermGen空间占VM内存总量的一部分 ,我的理解是不正确的。

you are right. 你是对的。 >512MB are spent for PermGen and <512MB are available for Heap > 512MB用于PermGen,<512MB用于Heap

use JVisualVM shipped with any Sun/Oracle JVM to connect to the running eclipse process and check the actual situation 使用任何Sun / Oracle JVM附带的JVisualVM连接到正在运行的Eclipse进程并检查实际情况

Enable GC logging, once the Eclipse crashes again, you will see the cause of the problem, the logs will show you the size of PermGen. 启用GC日志记录,一旦Eclipse再次崩溃,您将看到问题的原因,日志将显示PermGen的大小。

GC logging : -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=jvm.log -XX:+HeapDumpOnOutOfMemoryError -Xloggc:gc.log -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -showversion GC日志记录: -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=jvm.log -XX:+HeapDumpOnOutOfMemoryError -Xloggc:gc.log -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -showversion

Considering the PermGen being part of the Heap or not, this actually depends on the version of the Hotspot you are running. 考虑到PermGen是否是Heap的一部分,这实际上取决于您正在运行的Hotspot的版本。 The GC algorithm controls the size of the PermGen, so even though you set MAX=1GB, it may never grow that big and you can still get OOM because of some other issue. GC算法控制着PermGen的大小,因此即使您设置MAX = 1GB,它也可能永远不会变大,并且由于其他一些问题,您仍然可以获得OOM。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM