How To Increase Heap Size for ANT’s OutOfMemory Error using ANT_OPTS
Ever run into an ANT compilation or ANT task related compilation OutOfMemoryError problem? This little bugger of a problem can be rather tricky to debug. You may run into this problem when you have a large collection of source files to compile (think 1000+). You may also run into this problem with the following WebLogic ANT tasks:
1. jwsc
2. wlappc (LARGE JSP Pre-Compilations)
There may be other related compilation tasks, but bottom line is the Java Heap Size is too small. To increase it, you need to add $ANT_OPTS to your environment. An overkill, but also a sure way to fix the problem can be these values:
ANT_OPTS=”-Xmx1024m -Xms512m”
This variable must be set within your build machine’s environment. When ANT executes, it automatically includes $ANT_OPTS in its execution string. I hope this little hint will solve a lot of your future headaches. I’ve been troubleshooting a similar problem on a project I’m currently working on for the past 24 hours. We went from plan a, to b, to c, to d, and started to run into a dead end and wanted to go for a temp fix by disabling pre-compilation.. until I found this root cause.
If you’re not currently using $ANT_OPTS, perhaps you should look into implementing that on your infrastructure. May end up saving you a heap of debugging time down the road.
One Response to “How To Increase Heap Size for ANT’s OutOfMemory Error using ANT_OPTS”
Leave a Reply
Related Topics:
No related posts.

Great post! Just wanted to let you know you have a new subscriber- me!