Wednesday, 10 August 2011

Java :- Heap Size Error (JAVA )

//What is JVM Heap Size? How does it affect the performance of the Application?



//Error java.lang.OutOfMemoryError: Java heap space





Answer:-



Some times there may be no space for running the java program.At that time

programmer should increase the size of Heap area of JVM or Web Server.



For Increase the heap Size:



For a Run a Java Program Run with:- java -Xms65m -Xmx512 yourJavaFile

For run with Tomcat set the Environment Variable :- set JAVA_OPTS="-Xms256m -Xmx1024m"



Here



-Xms is the initial Java heap size

-Xmx is the maximum Java heap size

-Xss is the java thread stack size