Increasing size of heap memory in Java

In Java size of heap memory by default is 64MB, however if your application holds many objects then you might get the following exception,

java.lang.OutOfMemoryError: Java heap space 

There is a simple solution for the problem and it would be reached by increasing your heap size on runtime with the following command,

java -Xms256m -Xmx1024m YourClassName/JarFileName

The first parameter defines the minimum heap size and the second parameter sets the maximum size of heap for your application.

Send your idea and information to

Leave a Reply

Your email address will not be published. Required fields are marked *