Increase Heap Memory For Java Applications

December 5, 2007 at 12:10 am (Java, Study Refers, Tips n Tricks)

Many times you may crack out with an error like
Out Of Memory…
while running your java application. This is because of your jvm’s bounded heap size. You can alter this heap size by adding an argument to the command
java -Xms
java -Xmx
java -Xss

eg. java -Xmx32m will set the maximum heap size as 32MB.

Java Compiler has also some defaults for heap. These are initially set to 1GB so there is no need to worry about that. Moreover compiler job is not rigorous till we run a big set of code.
Launcher has 128MB as the maximum heap size and is generally reconfigured for biggies.
So, adjust your heap size according to your hardware capacity for optimized performance. 🙂


Permalink Leave a Comment