It Can be caused by
- Undersized Heap
- Memory fragmentation
- Memory leak in java code
- Not enough memory in native code
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