JVM的MaxPermSize参数设置

在JVM中除了有年轻代、年老代外,还一个持久代,主要用来存放类对象的meta-data,PermGen和你设置的Xmx无关,而是通过MaxPermSize设置。如果你的应用程序代码量很大会很快出现OutOfMemoryError。
引用

The permanent generation is special because it holds meta-data describing user classes (classes that are not part of the Java language). Examples of such meta-data are objects describing
classes and methods and they are stored in the Permanent Generation. Applications with large code-base can quickly fill up this segment of the heap which will cause java.lang.OutOfMemoryError: PermGen no matter how high your -Xmx and how much memory you have on the machine.



如果JVM不设置MaxPermSize这个参数,会使用默认值64M或32M(根据64位和32位环境而不同)。
-XX:MaxPermSize=64m 	Size of the Permanent Generation.  [5.0 and newer: 64 bit VMs are scaled 30% larger; 1.4 amd64: 96m; 1.3.1 -client: 32m.]


http://www.freshblurbs.com/explaining-java-lang-outofmemoryerror-permgen-space

你可能感兴趣的:(java,jvm,UP)