Memory areaseasy0-2 years

A teammate says "Metaspace is just PermGen with a new name." Someone else adds "and it can't run out of memory anymore, since it's not part of the heap." What's wrong with each claim?

Both are wrong, in opposite directions. Metaspace is a genuinely different mechanism, not a rename: before Java 8, class metadata lived inside the heap, in the Permanent Generation, sized by -XX:MaxPermSize and collected by the same generational GC that handled your objects. JEP 122 moved class metadata out of the heap entirely, into native memory — the same pool malloc draws from — where it's sized by -XX:MaxMetaspaceSize instead. The second claim gets the consequence backwards: moving out of the heap doesn't make Metaspace safe, it's unbounded by default, meaning it grows until it hits an explicit limit (if you set one) or until the operating system has nothing left to give — a class loader leak still throws OutOfMemoryError: Metaspace, it's just not fighting your objects for -Xmx anymore, it's fighting everything else on the machine for RAM.

The lesson behind it →
More on Memory areas