另外今天搭建环境时候还遇到 了一个异常:java.lang.OutofMemoryError:PermGen space
解决方案:配置tomcat下JDK的option
-Xms1024m -Xmx1024m -XX:MaxPermSize=256m
-Xms和-Xmx是设置Tomcat使用的内存的大小
-XX:MaxPermSize 指定类空间(用于加载类)的内存大小
下面摘自StackOverflow
Common mistakes people make is thinking that heap space and permgen space are same, which is not at all true. You could have lot of space remaining in the heap but still can run out of memory in permgen.
Common causes of OutofMemory in PermGen is ClassLoader. Whenever a class is loaded into JVM, all its meta data, along with Classloader, is kept on PermGen area and they will be garbage collected when the Classloader which loaded them is ready for garbage collection. In Case Classloader has a memory leak than all classes loaded by it will remain in memory and cause permGen outofmemory once you repeat it a couple of times. The classical example is 、
Now there are two ways to solve this: 1. Find the cause of Memory Leak or if there is any memory leak. 2. Increase size of PermGen Space by using JVM param -XX:MaxPermSize and-XX:PermSize.