PermGen vs. Metaspace
java.lang.OutOfMemoryError: PermGen space is very often caused by a memory leak related to classloaders, and creation of new classloaders, which generally happens during hot deployments of code.
The permanent generation contains information about classes, such as bytecode, names and JIT information. It is stored in a separate space, because it is mostly static and garbage collection can be much more optimized by separating it.
- PermGen: Java Heap; Java 7 partially removed, Java 8 totally removed, replaced by Metaspace
- Metaspace: native memory(C heap)