Tuesday, February 2, 2010

Java.lang.OutOfMemory Error

JVM error (Java.lang.OutOfMemory) that indicates a condition where not enough free memory is available to allocate a object

It Can be caused by
  • Undersized Heap
  • Memory fragmentation
  • Memory leak in java code
  • Not enough memory in native code
Different types

Exception in thread "main": java.lang.OutOfMemoryError: Java heap space

Exception in thread "main": java.lang.OutOfMemoryError: PermGen space

Exception in thread "main": java.lang.OutOfMemoryError: Requested array size exceeds VM limit

Exception in thread "main": java.lang.OutOfMemoryError: request bytes for . Out of swap space?

Exception in thread "main": java.lang.OutOfMemoryError: (Native method)