.NET Garbage Collector - what is its thread priority?

前端 未结 5 1483
囚心锁ツ
囚心锁ツ 2021-01-01 01:50

I have found some great articles (Maoni, Richter #1, Richter #2) giving many details as to the theory and practice of the GC, yet I cannot find anything that states how the

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-01 02:48

    The GC thread runs at a normal priority. The finalizer thread runs at "Highest" priority.

    You can see this by turning on the Debug "Thread" window, and breaking anywhere in a managed application. The threads are all listed (although they're not named), with their priorities. It takes a bit to decipher which is which, but there will be an extra "Normal" and "Highest" priority thread, which correspond to the GC and the Finalizer thread.

提交回复
热议问题