You can increase the heap size allocated by the Java Virtual Machine (JVM) using command-line options.
-Xms<size> set initial Java heap size -Xmx<size> set maximum Java heap size -Xss<size> set java thread stack size
If you are using the tomcat server, you can resize the heap by going to Eclipse / Run / Run Configuration and select Apache Tomcat / your_server_name / Arguments and in the VM arguments section use the following:
-XX:MaxPermSize=256m -Xms256m -Xmx512M
If you are not using any server, you can enter the following at a command prompt before running your code:
java -Xms64m -Xmx256m HelloWorld
More information on increasing heap size can be found here.
slashdot Jan 17 '13 at 16:54 2013-01-17 16:54
source share