Java Zero to All All questionsPractise free
Interview questions › JVM Internals & Runtime › JVM Architecture

Why does PermGen's removal in Java 8 matter, and what changed operationally with Metaspace?

Level III · MidJVM Architecture
Short answer

PermGen was a fixed-size region inside the Java heap that held class metadata, and exhausting it caused OutOfMemoryError: PermGen space, a classic failure in app servers that redeployed often and leaked class loaders.

Explanation

Metaspace moved this metadata to native memory that grows on demand, eliminating the most common PermGen OOM. The trade-off is that an unbounded leak now consumes native RAM instead, so in production you still cap it with -XX:MaxMetaspaceSize to fail fast rather than swallow the whole machine.

Common mistakes
  • Saying Metaspace is unlimited, so leaks cannot happen.
  • Forgetting to cap it with -XX:MaxMetaspaceSize when class-loader leaks are possible.

Can you say this out loud in two minutes? Drill it in a timed mock interview, with flashcards and runnable code for JVM Architecture.

Practise free

More on JVM Architecture