Metaspace is allocated outside the JVM heap and is not limited to a fixed size.
Unlike PermGen, which had a fixed size and was part of the heap, Metaspace is allocated from native memory, allowing it to grow dynamically as needed. This reduces the risk of OutOfMemoryErrors related to class metadata. For example, in a Spring application with many dynamic proxies, Metaspace's flexibility prevents the crashes that were common with PermGen.
Additional Notes
How does Metaspace differ from the old PermGen space?