GCMemoryInfo Struct


Provides a set of APIs that can be used to retrieve garbage collection information.

public value class GCMemoryInfo
public struct GCMemoryInfo
type GCMemoryInfo = struct
Public Structure GCMemoryInfo


A garbage collection (GC) is identified by its Index, which starts from 1 and increases with each GC. If you are asking for a GC that doesn't exist, for example, you called the GetGCMemoryInfo method before a GC happened, or you're asking for a GC of GCKind.FullBlocking and no full blocking GCs have happened, you will get all 0's in the info, including the Index. You can use index 0 to detect that no GCs, or no GCs of the kind you specified, have occurred.



Gets a value that indicates if this is a compacting GC or not.


Gets a value that indicates if this is a concurrent GC (background GC) or not.


Gets the number of objects that are ready for finalization that this GC observed.


Gets the total fragmentation when the last garbage collection occurred.


Gets the generation this GC collected. Collecting a generation also collects younger generations.


Gets the generation information for all generations.


Gets the total heap size when the last garbage collection occurred.


Gets the high memory load threshold when the last garbage collection occurred.


Gets the index of this GC. GC indices start with 1 and are increased at the beginning of a GC. Since the information is updated at the end of a GC, this means you can get the information for a background GC with a smaller index than a foreground GC that finished earlier.


Gets the physical memory load when the last garbage collection occurred.


Gets the pause durations. For blocking GCs, there is one pause; for background GC, there are two.


Gets the pause time percentage in the GC so far. If the pause time is 1.2%, this property's value is 1.2. The value is calculated by taking the sum of all GC pauses so far and dividing that by the total elapsed time of the process since the runtime was loaded. This running counter is updated at the end of each GC. It does not distinguish between GCKind. That is, at every GC, the calculated value is updated, and when you access this property, it gets the latest calculated value.


Gets the number of pinned objects this GC observed.


Gets the promoted bytes for this GC.


Gets the total available memory for the garbage collector to use when the last garbage collection occurred.


Gets the total committed bytes of the managed heap.

Applies to