COR_GC_STATS Structure

Provides statistics about the garbage collection mechanism of the common language runtime (CLR).

Syntax

typedef struct _COR_GC_STATS {  
    ULONG   Flags;
    SIZE_T  ExplicitGCCount;  
    SIZE_T  GenCollectionsTaken[3];  
    SIZE_T  CommittedKBytes;
    SIZE_T  ReservedKBytes;  
    SIZE_T  Gen0HeapSizeKBytes;  
    SIZE_T  Gen1HeapSizeKBytes;  
    SIZE_T  Gen2HeapSizeKBytes;  
    SIZE_T  LargeObjectHeapSizeKBytes;  
    SIZE_T  KBytesPromotedFromGen0;  
    SIZE_T  KBytesPromotedFromGen1;  
} COR_GC_STATS;  

Members

Member Description
Flags Indicates which field values should be calculated and returned.
ExplicitGCCount Indicates the number of garbage collections that were forced by external request.
GenCollectionsTaken Indicates the number of garbage collections performed for each generation.
CommittedKBytes The total number of kilobytes committed in all heaps.
ReservedKBytes The total number of kilobytes reserved in all heaps.
Gen0HeapSizeKBytes The size, in kilobytes, of the generation-zero heap.
Gen1HeapSizeKBytes The size, in kilobytes, of the generation-one heap.
Gen2HeapSizeKBytes The size, in kilobytes, of the generation-two heap.
LargeObjectHeapSizeKBytes The size, in kilobytes, of the large object heap.
KBytesPromotedFromGen0 The size, in kilobytes, of the objects promoted from generation zero to generation one.
KBytesPromotedFromGen1 The size, in kilobytes, of the objects promoted from generation one to generation two.

Remarks

The ICLRGCManager::GetStats method requires the Flags field of the COR_GC_STATS structure to be set to one or more values of the COR_GC_STAT_TYPES enumeration to specify which statistics are to be set.

The following table maps the statistics provided by this structure to the two COR_GC_STAT_TYPES enumeration values, COR_GC_COUNTS and COR_GC_MEMORYUSAGE.

Specified by COR_GC_COUNTS Specified by COR_GC_MEMORYUSAGE
ExplicitGCCount

GenCollectionsTaken
CommittedKBytes

ReservedKBytes

Gen0HeapSizeKBytes

Gen1HeapSizeKBytes

Gen2HeapSizeKBytes

LargeObjectHeapSizeKBytes

KBytesPromotedFromGen0

KBytesPromotedFromGen1

An example of the usage is as follows:

COR_GC_STATS GCStats;  
GCStats.Flags = COR_GC_COUNTS | COR_GC_MEMORYUSAGE;  
pCLRGCManager->GetStats(&GCStats);  

Requirements

Platforms: See System Requirements.

Header: GCHost.idl

Library: Included as a resource in MSCorEE.dll

.NET Framework Versions: Available since 1.0

See also