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.
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.
本文介绍了如何解决使用Ant进行XSLT转换时遇到的内存溢出错误。通过设置环境变量ANT_OPTS增加JVM堆大小,成功解决了问题。文中详细解释了如何配置并提供了一个具体的例子。
1426

被折叠的 条评论
为什么被折叠?



