Search code examples
c#garbage-collection

Does Server Collection Create A Seperate LOH Heap For Each Core? C#


From the research On Garbage Collection, Server Collection Allows for the creation of a separate thread for each CPU core that you have that runs a separate GC and Generational Heap. But I Wasn't Able to find anything On whether each thread gets its own LOH Heap Or There Is Just One LOH Heap Per App


Solution

  • Interesting question. It seems it does maintain a heap (small and large) per logical CPU, though not per thread. Which makes a lot of sense :)

    Workstation and server garbage collection

    Server GC

    The following are threading and performance considerations for server garbage collection:

    ...

    • A heap and a dedicated thread to perform garbage collection are provided for each logical CPU, and the heaps are collected at the same time. Each heap contains a small object heap and a large object heap, and all heaps can be accessed by user code. Objects on different heaps can refer to each other.