Is it possible to stop .NET garbage collection?

前端 未结 4 990
Happy的楠姐
Happy的楠姐 2020-12-17 17:37

Is it possible for a programmer to programmatically start/stop the garbage collection in C# programming language? For example, for performance optimization and so on.

4条回答
  •  北海茫月
    2020-12-17 18:26

    Not really. You can give the GC hints via methods like GC.AddMemoryPressure or GC.RemoveMemoryPressure but not stop it outright.

    Besides, garbage collection is not that intensive of a process. Programmers very rarely ever worry about it.

提交回复
热议问题