InterviewSolution
| 1. |
Is It Possible To Force Garbage Collector To Run? |
|
Answer» Yes, it POSSIBLE to force garbage collector to run by calling the Collect() method, but this is not considered a good practice because this might CREATE a performance over head. USUALLY the programmer has no CONTROL over when the garbage collector RUNS. The garbage collector checks for objects that are no longer being used by the application. If it considers an object eligible for destruction, it calls the destructor(if there is one) and reclaims the memory used to store the object. Yes, it possible to force garbage collector to run by calling the Collect() method, but this is not considered a good practice because this might create a performance over head. Usually the programmer has no control over when the garbage collector runs. The garbage collector checks for objects that are no longer being used by the application. If it considers an object eligible for destruction, it calls the destructor(if there is one) and reclaims the memory used to store the object. |
|