More Maven 2 – PermGen space this time!
February 27, 2009
So Maven in eclipse is a great time saver (and waster); in that it wastes a tonne of time setting up and learning, but saves a tonne of time in the long run on team projects.
This weeks maven problems have been running suites of testng test when doing a maven build; the old pergen memory not set high enough faults; but this time setting the paremeters was a bit harder.
here’s the fix(es):
set pergen space for eclipse (3.4) higher:
- run eclipse from the command line with the options:
eclipse -vmargs -Xms1536m -Xmx1536m -XX:PermSize=1024m -XX:MaxPermSize=2048m
- give maven more memory
export MAVEN_OPTS="-Xms1536m -Xmx1536m -XX:PermSize=1024m -XX:MaxPermSize=2048m"
now the bit that took ages to figure out – the maven eclipse plugin runs testng test through surefire on the console and returns back output to eclipse, not only that but it’s run through a jar using a jre – so to give this instance of the jre more memory you need to:
- Right Click ProjectName > Run As > Maven Build…
- Goals: (one of install, deploy etc)
install -e - JRE Tab > VM Arguments:
-Xms1536m -Xmx1536m -XX:PermSize=1024m -XX:MaxPermSize=2048m
AFAIK this and only this will allocate enough memory for the the test suite to run
Joy
August 31st, 2009 at 9:43 am
Hi,
PermGen error may be perhaps due to some static classes in your project which won't get garbage collected as expected. This is typical in web applications which runs on it's own class loader.