Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies the kind of a garbage collection.
public enum class GCKind
public enum GCKind
type GCKind =
Public Enum GCKind
Any kind of collection.
A background collection. This is always a generation 2 collection.
A gen0 or gen1 collection.
A blocking gen2 collection.
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.