GCSettings.LargeObjectHeapCompactionMode Özellik
Tanım
Tam engelleyici bir çöp toplamanın büyük nesne yığınını (LOH) sıkıştırır olup olmadığını gösteren bir değer alır veya ayarlar.Gets or sets a value that indicates whether a full blocking garbage collection compacts the large object heap (LOH).
public:
static property System::Runtime::GCLargeObjectHeapCompactionMode LargeObjectHeapCompactionMode { System::Runtime::GCLargeObjectHeapCompactionMode get(); void set(System::Runtime::GCLargeObjectHeapCompactionMode value); };
[set: System.Security.SecurityCritical]
public static System.Runtime.GCLargeObjectHeapCompactionMode LargeObjectHeapCompactionMode { get; set; }
public static System.Runtime.GCLargeObjectHeapCompactionMode LargeObjectHeapCompactionMode { get; set; }
[<set: System.Security.SecurityCritical>]
member this.LargeObjectHeapCompactionMode : System.Runtime.GCLargeObjectHeapCompactionMode with get, set
member this.LargeObjectHeapCompactionMode : System.Runtime.GCLargeObjectHeapCompactionMode with get, set
Public Shared Property LargeObjectHeapCompactionMode As GCLargeObjectHeapCompactionMode
Özellik Değeri
Tam engelleme çöp toplamanın LOH 'yi sıkıştırıp sıkıştırmadığını belirten sabit listesi değerlerinden biri.One of the enumeration values that indicates whether a full blocking garbage collection compacts the LOH.
- Öznitelikler
Açıklamalar
LOH, 85.000 bayttan fazlasını gerektiren büyük nesneler (diziler gibi) için bellek ayırmak üzere kullanılır.The LOH is used for allocating memory for large objects (such as arrays) that require more than 85,000 bytes. Büyük bellek bloklarını kopyalamanın performans etkisi nedeniyle, atık toplayıcı genellikle, ölü nesneler tarafından kullanılan ve büyük nesneler için bellek ayırmaya yönelik gelecekteki istekleri karşılamak üzere yeniden kullanılabilen bellek konumlarının bir listesini oluşturmayı içeren LOH 'yi de içerir.Because of the performance impact of copying large blocks of memory, the garbage collector ordinarily sweeps the LOH, which involves creating a list of the memory locations that were occupied by dead objects and that can be reused to satisfy future requests for allocation of memory for large objects. Ancak, LOH 'yi geçici nesneleri depolamak için kapsamlı olarak kullanan uygulamalarda, bellek parçalanması performansı olumsuz yönde etkileyebilir.However, in apps that make extensive use of the LOH to store transient objects, memory fragmentation can also adversely impact performance. Bu durumda, LargeObjectHeapCompactionMode bir çöp toplama sırasında LOH 'yi tarama yerine sıkıştırmak için özelliği kullanmak mümkündür.In this case, it is possible to use the LargeObjectHeapCompactionMode property to compact rather than simply sweep the LOH during a garbage collection.
Özelliğinin varsayılan değeri, LargeObjectHeapCompactionMode GCLargeObjectHeapCompactionMode.Default Loh 'nin çöp koleksiyonları sırasında sıkıştırılmadığını gösterir.The default value of the LargeObjectHeapCompactionMode property is GCLargeObjectHeapCompactionMode.Default, which indicates that the LOH is not compacted during garbage collections. Özelliğini değerini atarsanız GCLargeObjectHeapCompactionMode.CompactOnce , LOH bir sonraki tam engelleme çöp toplama işlemi sırasında sıkıştırılır ve özellik değeri olarak sıfırlanır GCLargeObjectHeapCompactionMode.Default .If you assign the property a value of GCLargeObjectHeapCompactionMode.CompactOnce, the LOH is compacted during the next full blocking garbage collection, and the property value is reset to GCLargeObjectHeapCompactionMode.Default.
Not
Arka plan atık koleksiyonları engellenmiyor.Background garbage collections are not blocking. Yani, LargeObjectHeapCompactionMode özelliğini olarak ayarlarsanız GCLargeObjectHeapCompactionMode.CompactOnce , daha sonra da Loh 'yi sıkıştıramayan tüm arka plan oluşturma 2 koleksiyonları.This means that, if you set the LargeObjectHeapCompactionMode property to GCLargeObjectHeapCompactionMode.CompactOnce, any background generation 2 collections that occur subsequently do not compact the LOH. Yalnızca ilk engelleyen nesil 2 koleksiyonu, LOH 'yi sıkıştırır.Only the first blocking generation 2 collection compacts the LOH.
LargeObjectHeapCompactionModeÖzelliği olarak ayarlandıktan sonra GCLargeObjectHeapCompactionMode.CompactOnce , bir sonraki tam engelleme çöp toplama (ve Loh sıkıştırması), daha sonra bir süre sonra oluşur.After the LargeObjectHeapCompactionMode property is set to GCLargeObjectHeapCompactionMode.CompactOnce, the next full blocking garbage collection (and compaction of the LOH) occurs at an indeterminate future time. Aşağıdaki gibi bir kod kullanarak LOH 'yi hemen sıkıştırabilirsiniz:You can compact the LOH immediately by using code like the following:
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
GC.Collect();
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce
GC.Collect()