What is Garbage Collector?

Garbage collector serves as a automatic memory manager. It has the following benefits:

  • It would enable us to develop our application without having to free memory.
  •  It allocates objects on managed heap efficiently.
  •  It reclaims the objects that are no longer being used, clears their memory and keeps the memory available for future allocations.
  •  It provides memory safety by making sure that an object cannot use the context of another object.