Can we force Garbage Collector to run ?

 Posted by Chvrsri on 3/23/2011 | Category: C# Interview questions | Views: 4341 | Points: 40

Yes we can,

It is Possible to force Garbage Collector this can be done by calling a method called Collect().

But this makes a performance barrier since this is not a good programming practice.

Generally we have no control over garbage collector when it runs.

The main work of this GC is it checks if there are any objects which are not used by the application it calls a Destructor which frees the memory allocated to that unused objects.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response