I'm running a very long process via an Ant script, I allowed the following heap but it still give me the error.
set ANT_OPTS=-Xms1024M -Xmx2024M -XX:MaxPermSize=512M
I'm running a very long process via an Ant script, I allowed the following heap but it still give me the error.
set ANT_OPTS=-Xms1024M -Xmx2024M -XX:MaxPermSize=512M
It seems strange to me that you are using more 2G to perform a build (although it's clearly possible) so I'll make some silly questions just to help you thinking on your problem:
This means that your code really is trying to use more than 2G of memory. Use jprofiler, or yourkit, or the JVM's built-in tools, to find out what it's doing and reduce the memory usage.
Further, if on a 32-bit machine, you can't necessarily get a full 2G.
You can also enable garbage collection logging (details here) and have a look at why your Heapspace is increasing so much. It could be a memory leak. Ofcourse, JProfiler will also allow you to do the same. Eclipse 3.4 and above have a profiler built in which you can attach to the JVM where your program is running if you do not wish to use JProfiler.