This topic has not yet been rated - Rate this topic

GCSettings.LargeObjectHeapCompactionMode Property

.NET Framework 4.5

[This topic is preliminary and is subject to change.]

Gets or sets a value that indicates whether a full blocking garbage collection compacts the large object heap (LOH).

Namespace:  System.Runtime
Assembly:  mscorlib (in mscorlib.dll)
public static GCLargeObjectHeapCompactionMode LargeObjectHeapCompactionMode { get; set; }

Property Value

Type: System.Runtime.GCLargeObjectHeapCompactionMode
One of the enumeration values that indicates whether a full blocking garbage collection compacts the LOH.

The default value of the LargeObjectHeapCompactionMode property is GCLargeObjectHeapCompactionMode.Default, which indicates that the LOH is not compacted during garbage collections. If you assign the property a value of GCLargeObjectHeapCompactionMode.CompactOnce, the LOH is compacted during the next blocking garbage collection, and the property value is reset to GCLargeObjectHeapCompactionMode.Default.

If the LargeObjectHeapCompactionMode property is set to GCLargeObjectHeapCompactionMode.Default, the next full blocking garbage collection (and compaction of the LOH) occurs at an indeterminate future time. You can compact the LOH immediately by using code like the following:

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

.NET Framework

Supported in: 4.5

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.