Per-thread memory management in C#

后端 未结 3 1087
谎友^
谎友^ 2020-12-16 07:19

Continuing the discussion from Understanding VS2010 C# parallel profiling results but more to the point:

I have many threads that work in parallel (using Parallel.Fo

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-16 08:02

    I searched for two days trying to find an answer to the same issue you had. The answer is you need to set the garbage collection mode to Server mode. By default, garbage collection mode set to Workstation mode. Setting garbage collection to Server mode causes the managed heap to split into separately managed sections, one-per CPU. To do this, you need to add a config setting to your app.config file.

    
       
    
    

    The speed difference on my 12-core Opteron 6172 was dramatic!

提交回复
热议问题