java.lang.OutOfMemoryError: Java heap space Exception in Java

Question java.lang.OutOfMemoryError: Java heap space
What does this error mean and how can I correct it?  

It means that the JVM has run out of all the memory that has been allocated to it. You can change the amount of memory allocated for use by your JVM using the -Xms and -Xmx command line parameters.

For example, the following says run MyApp in a JVM and allocate a minimum of 5 Megabytes and a maximum of 15 Megabytes off of the heap in order to do so.

   java -Xms5m -Xmx15m MyApp  

In tomcat the heap size can be passed to the java here.
"$_RUNJAVA" -Xmx512M $JAVA_OPTS $CATALINA_OPTS
 

No comments:

Post a Comment

Please Provide your feedback here