I\'m confused with Heap,Young,Tenured and Perm generation.
Could anyone please explain?
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.