how to increase ant permgen size? I have given in ANT_OPTS as
-Xms768m -Xmx1024m -XX:PermSize=128m
-XX:MaxPermSize=128m
question
1)After specifying above setting in system environment, still i am getting outof memeory error for ant target for junit.
Caught an exception while logging the end of the build. Exception was:
java.lang.OutOfMemoryError: PermGen space
2) when i type in command promt to see what is path for ant_opts, echo %ant_opts% it shows only
-Xmx512m
and other parts skips. is something wrong in my path?
Note: i am using command prompt to run ant target.
go to my computer->right click->properties->Advanced->environment variables->New(in system/user variable)->
enter
Varible name: ANT_OPTS
Varible Value : -Xms1536m -Xmx1536m -XX:PermSize=1024m -XX:MaxPermSize=2048m
Note:
configure values according to your system memory size.
This config for windows, for other OS config accordingly
For MAC:
in Terminal, goto pom.xml path in project, run below command:
export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=512m" Note: Size is based on system RAM.
I used maven instead of old Ant. use MAVEN_OPTS/ANT_OPTS for maven/ant config.
What does your test do? Does it call a recursive method?
Also, the values that you enter for your test will override any system setting. Try this in your call to junit in your Ant script:
<junit fork="yes" maxmemory="1024">
for my junit ant target I just set fork="true"
that way a new jvm would be initiated for the junit tasks, there's also forkmode="perBatch"
or "perTest"
, worked for me!