Run GC.Collect synchronously

前端 未结 4 1083
情深已故
情深已故 2020-12-06 16:33

GC.Collect appears to start the garbage collection in a background thread, and then return immediately. How can I run GC.Collect synchronously -- i

4条回答
  •  [愿得一人]
    2020-12-06 17:26

    Finalizers always run on a separate thread regardless of whether you're using a concurrent GC or not. If you want to ensure that finalizers have been run, try GC.WaitForPendingFinalizers instead.

提交回复
热议问题