18 July 2007

ANT Heap Memory

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.

3 comments:

Anonymous said...

Nice!

jtanzy said...

That was good.

I tried with this option but got this error when running ant command [ant eclipse setup]--

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

Could you please tell me the way to resolve it.

Thanks,
Tanzy.

Anonymous said...

Try this and it will do:

SET ANT_OPTS=-Xms256m -Xmx256m