Pergunta

A colleague has the following setting in Eclipse / Tomcat run parameters, and complains of out of heap memory all the time:

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

If I understand this correctly, both the max PermGen and max Heap are each 1 GB. Since PermGen is a special part of the Heap, this amounts to allocating all of the heap to PermGen. Is this correct?

Per Perm Space vs Heap Space, I might be correct. Would this be causing the issue?

Per Is Java PermGen Space Part of Total VM Memory, my understanding is not correct.

Foi útil?

Solução 2

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 logging :-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. 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.

Outras dicas

you are right. >512MB are spent for PermGen and <512MB are available for Heap

use JVisualVM shipped with any Sun/Oracle JVM to connect to the running eclipse process and check the actual situation

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top