1
Reply

How does Garbage collector(GC) works in .net

17y
7.3k
0
Reply

    In .NET Garbage Collector maintained by CLR. The process of GC is reclaim the memory of objets which is no longer referenced by our program.Next thing is GC runs undeterministicly because of that we can't assure we the object will be released from the Heap Location.But the CLR maintain a Logical Pointer to every object which referenced by our program. In some amount of time the GC look out the objects which is reachable from Logical Pointer. whatever the object reachable from pointer it create a map those objects. After that it will reclaim the memory of objects those are not reachable from the pointer.This is the process of how the GC clear the memory of Object.