What causes memory fragmentation in .NET

后端 未结 3 1471
南方客
南方客 2020-12-02 16:57

I am using Red Gates ANTS memory profiler to debug a memory leak. It keeps warning me that:

Memory Fragmentation may be causing .NET to reserver too

3条回答
  •  有刺的猬
    2020-12-02 17:10

    The .NET Framework 4.5.1, has the ability to explicitly compact the large object heap (LOH) during garbage collection.

    GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
    GC.Collect();
    

    See more info in GCSettings.LargeObjectHeapCompactionMode

提交回复
热议问题