Is there a way to force garbage collection?
By in C# on Jul 14 2006
  • Keerthi Venkatesan
    Apr, 2016 22

    GC.Collect();

    • 0
  • Pramod Verma
    Jan, 2015 24

    GC.Collect();

    • 0
  • nikhil kansal
    Jul, 2006 14

    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().

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS