PrepZone Logo
PrepZone
Back to Java

Java · Easy

Difference between OutOfMemoryError and StackOverflowError.

JavaMemory & JVMJVM

Answer preview

OutOfMemoryError — Thrown when the JVM cannot allocate memory on the heap (or Metaspace). Common causes: memory leaks, loading too much data, insufficient -Xmx. Variants include Java heap space, Metaspace, GC overhead limit exceeded.…