About

Sunday, September 29, 2019

Garbage Collection in C# Interview Question 


What is Garbage Collection

Garbage collection is one of most important future in the .Net Framework environment

Futures : 

1. When we have a class that represents an object in the runtime that allocates a memory space in the heap memory.

2. When there isn't enough memory to allocate an object, the GC must collect and dispose of garbage memory to make memory available for ne allocations


3. You can force garbage collection either to all the three generations or to a specific generation using the GC.Collect() method the GC.Collect() Method is overloaded you can call it without any parameters or event by passing the generation number you would like to the garbage collector to collect.

4 it determines when an instanciated class is no longer in using and reclaims memory.

5. The .Net  language does not do so the CLR does so. that's why its called "automatic garbage collection"

There are three type in generation :



2 comments: