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 |