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.