MyBigMemoryClass instance = GetMyInstance(); // Do something with instance instance = null; // Unroot this, so there are (hopefully) no references to it left GC.Collect(); // Collect everything
Using finalize or dispose
Mr.Hussain is right
Call garbage collector programmatically, use code โ GC.Collect(); โ