Can I force memory cleanup in C#?

后端 未结 5 597
执念已碎
执念已碎 2021-01-12 18:02

I heard that C# does not free memory right away even if you are done with it. Can I force C# to free memory?

I am using Visual Studio 2008 Express. Does that mat

5条回答
  •  囚心锁ツ
    2021-01-12 18:49

    You can force the garbage collector to collect unreferenced object via the

    GC.Collect()
    

    Method. Documentation is here.

提交回复
热议问题