GCKind Enum

Definition

Specifies the kind of a garbage collection.

public enum GCKind
Inheritance

Fields

Name Value Description
Any 0

Any kind of collection.

Ephemeral 1

A gen0 or gen1 collection.

FullBlocking 2

A blocking gen2 collection.

Background 3

A background collection. This is always a generation 2 collection.

Remarks

A GC can be one of the 3 kinds - ephemeral, full blocking, or background. Their frequencies are very different. Ephemeral GCs happen much more often than the other two kinds. Background GCs usually happen infrequently, and full blocking GCs usually happen very infrequently. In order to sample the very infrequent GCs, collections are separated into kinds so callers can ask for all three kinds while maintaining a reasonable sampling rate. For example, if you're sampling once every second, without this distinction, you may never observe a background GC. With this distinction, you can always get info of the last GC of the kind you specify.

Applies to

Продукт Версии
.NET 5, 6, 7, 8, 9