Search This Blog

Total Pageviews

What is java.lang.OutOfMemoryError in Java?

As the name specifies, this is the run time exception caused when there is no enough memory in Java Heap.

OutofMemoryError can be due to

1) Java Heap Space or
2) PermGen Space (Stores String Pools and various meta data)

This is not a program error, but programatic memory leaks could cause OutOfMemoryError.

How to Increase Memory?

Various JVM's(Eclipse/Tomcat/Weblogic/etc.,) has different ways to setup. Bottom line is set JVM args to increase memory.

set JVM_ARGS="-Xmx1024m -XX:MaxPermSize=256m"

How to find memory leaks?

Try Eclipse Memory Analyzer tool or Visualgc or Jmap to detect the problematic code.

No comments:

MongoDB Tutorial MongoDB Tutorial Table of Contents Introduction to MongoDB Installation Creating a Database Creati...