Search code examples
javajvmheap-memorypermgen

PermGen Space in Java 6 was not a part of Heap Memory?


Was PermGen Space in Java 6 not a part of Heap Memory? I got this question while reading about PermGen space allocation in java 7. As per Java 7 it says its a part of heap memory, this means that there is no fixed size limitation. So method area(PermGen) is logically a part of heap. That brings me to notice, that method area was not a part of heap before java 7.

If not then how the PermGen was allocated in java 6 and under which memory?


Solution

  • In common, the entire memory allocated to JVM is called heap memory by Java developers as heap is the dominating JVM memory. But heap memory is a separate group in JVM memory. It has new space and old space. Non-heap is another group in JVM that uses PermGem (Permanent Generation) memory to store class metadata and string constants.

    PermGen memory was never part of heap memory. It is part of non-heap memory. But in Java 8, permanent memory is replaced with metaspace in order to support some performance improvements.