Answered Questions

  • Is there a way to force garbage collection?

    Yes. Set all references to null and then call System.GC.Collect().If you need to have some objects destructed, and System.GC.Collect() doesn't seem to be doing it for you, you can force finalizers to be run by setting all the references to the object to null and then calling System.GC.RunFinalizers().

    Sivakrishna

    • Nov 12th, 2007

    GC.Collect();It is recomended that you should not forcefully call the GC. GC does it in the optimal way, since it knows the inner details like which object actually created inner objects.But some case...