What changed in JDK 8 regarding PermGen and Metaspace?

In JDK 8, the Permanent Generation (PermGen) was removed and replaced by Metaspace. PermGen was a fixed-size memory area inside the JVM heap used to store class metadata, which often led to OutOfMemoryError when the allocated space was exhausted. Metaspace stores class metadata in native memory and can grow dynamically, providing better scalability and reducing memory management issues.

Key Points

Example

In applications that dynamically load many classes, such as application servers or frameworks, PermGen could become full and cause startup or runtime failures. Metaspace handles such workloads more efficiently by expanding as needed.

# JDK 7 (PermGen)

-XX:PermSize=128m
-XX:MaxPermSize=256m

# JDK 8+ (Metaspace)

-XX:MetaspaceSize=128m
-XX:MaxMetaspaceSize=256m

Interview Tip

A concise interview answer is: JDK 8 removed PermGen and introduced Metaspace. Unlike PermGen, which had a fixed size within the heap, Metaspace uses native memory and grows dynamically, improving scalability and reducing metadata-related OutOfMemoryError issues.

Last updated: 11 November 2026

Previous question: How does Executor check the number of active or dead threads, and what is the internal working of the thread pool executor?

Next question: What is the difference between REST services and RESTful web services?

More Core Java - Level V (Expert) interview questions

All Core Java - Level V (Expert) questions