PermGen and Heap, Difference and their significance

后端 未结 5 456
闹比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:53

    Memory(Heap) is managed in generations, or memory pools holding objects of different ages. Garbage collection occurs in each generation when the generation fills up. Objects are allocated in a generation for younger objects or the young generation, and because of infant mortality most objects die there.

    When any new object is constructed it goes to Eden space which is a part of Young Generation.

    If object is still alive after some time it goes to tenured generation where long lived objects lie.

    If object is supposed to live until over process exist then object is moved to Perm Generation.Java classes are stored in the permanent generation.

提交回复
热议问题