Maven项目使用tomcat插件启动后报内存溢出

问题: 
maven项目在pom.xml配置tomcat插件后启动,运行时报内存溢出。 

tomcat插件配置如下: 

 <plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>8080</port>

                   <testFailureIgnore>true</testFailureIgnore>  
<uriEncoding>UTF-8</uriEncoding>
<!--<path>/urbanSpace1-web</path>-->
<systemProperties>
<JAVA_OPTS>-Xms512m -Xmx1024m -XX:MaxPermSize=256m</JAVA_OPTS>
</systemProperties>
</configuration>
</plugin>

 报错如下:

java.lang.OutOfMemoryError:PermGen space

原因: 
java虚拟机装载类的空间不够,永久内存超出,主要是因为项目功能增加后,加载的jar或class过多造成的。

解决方案: 
增加jvm内存,在maven的run configuration中增加如下配置,扩大初始化内存。 
-Xms1024M -Xmx2048M -XX:PermSize=256M -XX:MaxNewSize=256M -XX:MaxPermSize=512M

Maven项目使用tomcat插件启动后报内存溢出

通过jvisualvm.exe我们可以看到初始化的内存