I am trying to use maven for my project work but i am stuck with memory related issues.
When i run the maven i get the heap space error which i fixed using the following line
set MAVEN_OPTS="-Xmx1586m"
after this when i run the maven again, i don’t get the heap space error but rather i get the PermGen space error. For solving that i used the following syntax
set MAVEN_OPTS="-Xmx1586m -XX:MaxPermSize=512m"
but once i start using the MaxPermSize option i get the following error
Invalid maximum heap size: -Xmx1586m -XX:MaxPermSize=512m
Could not create the Java virtual machine.
I have tried setting different value combination for Xmx and MaxPermSize to bring the size in control but all are invalid.
I get this error only when i put MaxPermSize option in the MAVEN_OPTS. Once i remove that option i don’t get the error mentioned above but i do get the PermGen error.
Any suggestions what I am doing wrong?
you can try to set the initial heap size and initial permgen size relatively small, but set the proper max heap and pergent via -Xms128m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m
Also don’t set permgen to 512 – it’s too much for typical scenarious.
Also you may want to use fork option with maven and start plugin execution in different JVMs at all.
For example
Also, while allocating memory also make sure that you have that much free memory available.