PermGen and Heap, Difference and their significance

后端 未结 5 457
闹比i
闹比i 2021-02-01 23:19

Friends,

Can you please give me significance, difference and uses for Heap and PermGen. Also it would be good to know what class are loaded in them respectively.

5条回答
  •  孤独总比滥情好
    2021-02-01 23:42

    I was having the same doubt about the PermGen and other Heap memory parts. After doing some search, here what I finally concluded.

    Java HotSpot VM needs memory which it gets from the operating system, this memory is termed as Heap memory. Now heap memory as famously known to store the objects and holds other important things as well.

    Short live span Java objects are stored in the young generation and if those objects are still needed for further execution then, it is shifted to the tenure/old generation. And depending upon the type of Generation Garbage Collector, memory is cleaned.

    What about the Permanent Generation (PermGen)? Java HotSpot VM loads the classes/class structure in the PermGen which is used by JVM to store loaded classes and other meta-data. PermGen is not used to store objects.

    Apart from objects and class structure, JVM code itself loads profiler agent code and data etc.

    So basically, heap = object + class structure + JVM architecture.

    References: Java Docs, Java GC Guide

提交回复
热议问题