`
qqdwll
  • 浏览: 131619 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Ant OutOfMemory

    博客分类:
  • Java
阅读更多
I ran across a little tip tonight I thought I should share. Trying to perform a large XSLT tranform with Ant kept giving me the following error: Out of memory. Increase Heap Size.

This is a Java error indicating that the virtual machine is out of memory. So now I know what the problem is, what next? If I was launching from a command line changing the heap size is not that tough. Just look up the options for java and set a new value, but I’m using Ant. Looking at the Ant shell script or batch file was no help.

Well a bit of Googling turned up that Ant looks for an environment variable called ANT_OPTS which is use to set Java parameters. Just set the environment variable and off you go. So I added the following to increase the heap size:

export ANT_OPTS=-Xmx256m

That sets the maximum heap size to 256 Megabytes. It solved my problem as the XSLT transform topped out at about 220Meg. So if you ever need to increase the size of the Ant JVM, now you know how.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics