Question: how gc works in c#?
Answer: What is Garbage Collection and Why We Need It? When you create any object in C#, CLR (common language runtime) allocates memory for the object from heap. ... GC (Garbage collector) makes a trip to the heap and collects all objects that are no longer used by the application and then makes them free from memory.