2
Reply

How the genarations works? how the garbage collector knows when to move where what to look for where

How the genarations works? how the garbage collector knows when to move where what to look for where

    Garbage collection is the technique by which memory is managed automatically by reclaiming unused memory. It is a feature present in programming languages like Java, due to which the programmers need not keep track of the unused objects and destroy them. It is done automatically using Garbage Collection

    Mainly the GC has 3 generations Generation 0 : where the short lived objects are resides Generation 1 : where the space between the short lived and long lived objects are lived Generation 3 : where the actual long lived objects are lived