Large Object Heap compaction
suggest changeBy default the Large Object Heap is not compacted unlike the classic Object Heap which can lead to memory fragmentation and further, can lead to OutOfMemoryException
s
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();
Just as any explicit garbage collection request (it’s called request because the CLR is not forced to conduct it) use with care and by default avoid it if you can since it can de-calibrate GC
s statistics, decreasing its performance.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents