Set the memory available to the JVMTag(s): Environment
If your program allocates a lot of memory, you may need to increase this value to give more room to the garbage collector.
When starting the JVM, two parameters can be adjusted to suit your memory needs :
-Xms<size> specifies the initial Java heap size and
-Xmx<size> the maximum Java heap size.
To set the minimum at 64Mb and the maximum at 256Mb
java -Xms64m -Xmx256m ...
The default value for the minimum is 2Mb, for the maximum it's 64Mb.