Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to increase ant permgen size?

Tags:

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.

like image 651
TechFind Avatar asked Jun 17 '11 14:06

TechFind


People also ask

How can I increase my PermGen size?

To increase PermGen, we have the following commands: -XX:PermSize=N - sets the initial (and minimum size) of the Permanent Generation space. -XX:MaxPermSize=N - sets the maximum size of the Permanent Generation space.

How do I set MaxPermSize in Linux?

You can set the minimum and maximum memory heap size with the JVM -Xms and -Xmx parameters, for example, setting the minimum heap size to 128 MB and the maximum heap size to 1024 MB. Let's first understand what -Xms, -Xmx, -XX:PermSize and -XX:MaxPermSize are, -Xmx<size> - Set initial Java heap size.


2 Answers

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:

  1. configure values according to your system memory size.

  2. 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.

like image 195
AKB Avatar answered Sep 23 '22 18:09

AKB


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"> 
like image 28
bakoyaro Avatar answered Sep 23 '22 18:09

bakoyaro