Large Object Heap compaction
suggest changeBy default the Large Object Heap is not compacted, unlike the small object heap, which can lead to memory fragmentation and then to OutOfMemoryExceptions.
Starting with .NET 4.5.1 there is an option to explicitly compact the Large Object Heap (along with a garbage collection):
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
GC.Collect();
Treat this like any other explicit GC.Collect request and avoid it unless you have measured a large-object fragmentation problem. It can distort the GC's statistics and hurt later collections.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents