在Linux的shell中,使用export设置ANT_OPTS变量,值为1G

export ANT_OPTS=-Xmx1g
ant

同理在windows的cmd中,使用set设置ANT_OPTS变量,值为1G

set ANT_OPTS=-Xmx1g
ant

如果想设置成1.5G,使用 -Xmx1536m

 

如果是javac任务,需要使用'memoryinitialsize' 和 'memorymaximumsize'来指定

javac   srcdir="${src}"
            destdir="${classes}"
            source="1.6"
            debug="true"
            fork="true"
            deprecation="off"
            memoryinitialsize="512m"
            memorymaximumsize="1024m"

 

 

如果报java.lang.OutOfMemoryError: PermGen space错误

设置方法:

ANT_OPTS="-Xmx2g -XX:MaxPermSize=512m"

 

 

参考:http://stackoverflow.com/questions/7494909/build-failed-java-lang-outofmemoryerror-java-heap-space

相关文章:

  • 2021-08-21
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-20
  • 2021-12-08
  • 2022-12-23
  • 2021-08-28
  • 2021-07-13
相关资源
相似解决方案