Young , Tenured and Perm generation

前端 未结 4 579
南方客
南方客 2020-12-07 09:29

I\'m confused with Heap,Young,Tenured and Perm generation.

Could anyone please explain?

4条回答
  •  粉色の甜心
    2020-12-07 09:50

    All objects in the heap survive when they are being referenced. When they're not more, the garbage collector (GC) will reclaim their memory.

    PermGen, Young and Tenured are diferent clasifications of objects (or spaces in the heap where they can be).

    PermGen: these objects will be always there, they're not garbage collected. Classes objects are there, interned strings, etc. I don't know if there is a GC there (when system UNloads classes... but it's not a normal thing)

    Young: when an object is created it's here.

    Tenured: an object goes to this classification/category when it survives N GC passes (survive = GC passes but this object is referenced so it can't be reclaimed).

    Depending of GC used and some parametrization, GC passes more or less often.

    Then garbage collection can have different approaches to maange objects in the heap. This classification of objects helps to do it.

提交回复
热议问题