Setting Maven Heap and PermGen Size
Thursday, 26 December 2013, 14:59
Tags: Maven
Once in a while you will run into memory problems when using maven. Whether it is a java.lang.OutOfMemoryError: Java heap space or java.lang.OutOfMemoryError: PermGen space, these problems can be fixed by increasing the heap and/or permgen size. This can be done by setting some extra options in the
MAVEN_OPTS environment variable as in the following example.
With these options the different memory settings can be tuned:
-Xms512m: sets the initial heap size to 512 MB-Xmx1024m: sets the maximum heap size to 1 GB-XX:PermSize=256m: sets the initial PermGen size to 256 MB-XX:MaxPermSize=512m: sets the maximum PermGen size to 512 MB