Memory Performance Counters 

The Performance console .NET CLR Memory category includes counters that provide information about the garbage collector. The following table describes these performance counters.

Performance counter Description

# Bytes in all Heaps

Displays the sum of the Gen 0 Heap Size, Gen 1 Heap Size, Gen 2 Heap Size, and the Large Object Heap Size counters. This counter indicates the current memory allocated in bytes on the garbage collection heaps.

# GC Handles

Displays the current number of garbage collection handles in use. Garbage collection handles are handles to resources external to the common language runtime and the managed environment.

# Gen 0 Collections

Displays the number of times the generation 0 objects (that is, the youngest, most recently allocated objects) are garbage collected since the application started.

Generation 0 garbage collection occurs when the available memory in generation 0 is not sufficient to satisfy an allocation request. This counter is incremented at the end of a generation 0 garbage collection. Higher generation garbage collections include all lower generation collections. This counter is explicitly incremented when a higher generation (generation 1 or 2) garbage collection occurs.

This counter displays the last observed value. The _Global_ counter value is not accurate and should be ignored.

# Gen 1 Collections

Displays the number of times the generation 1 objects are garbage collected since the application started.

The counter is incremented at the end of a generation 1 garbage collection. Higher generation garbage collections include all lower generation collections. This counter is explicitly incremented when a higher generation (generation 2) garbage collection occurs.

This counter displays the last observed value. The _Global_ counter value is not accurate and should be ignored.

# Gen 2 Collections

Displays the number of times the generation 2 objects are garbage collected since the application started. The counter is incremented at the end of a generation 2 garbage collection (also called a full garbage collection).

This counter displays the last observed value. The _Global_ counter value is not accurate and should be ignored.

# Induced GC

Displays the peak number of times garbage collection was performed because of an explicit call to GC.Collect. It is good practice to let the garbage collector tune the frequency of its collections.

# of Pinned Objects

Displays the number of pinned objects encountered in the last garbage collection. A pinned object is one that the garbage collector cannot move in memory. This counter tracks the pinned objects only in the heaps that are garbage collected. For example, a generation 0 garbage collection causes enumeration of pinned objects only in the generation 0 heap.

# of Sink Blocks in use

Displays the current number of syncronization blocks in use. Synchronization blocks are per-object data structures allocated for storing synchronization information. Synchronization blocks hold weak references to managed objects and must be scanned by the garbage collector. Synchronization blocks are not limited to storing synchronization information; they can also store COM interop metadata. This counter indicates performance problems with heavy use of synchronization primitives.

# Total committed Bytes

Displays the amount of virtual memory, in bytes, currently committed by the garbage collector. Committed memory is the physical memory for which space has been reserved in the disk paging file.

# Total reserved Bytes

Displays the amount of virtual memory. in bytes, currently reserved by the garbage collector. Reserved memory is the virtual memory space reserved for the application but no disk or main memory pages have been used.

% Time in GC

Displays the percentage of elapsed time that was spent performing a garbage collection since the last garbage collection cycle. This counter usually indicates the work done by the garbage collector to collect and compact memory on behalf of the application. This counter is updated only at the end of every garbage collection. This counter is not an average; its value reflects the last observed value.

Allocated Bytes/second

Displays the number of bytes per second allocated on the garbage collection heap. This counter is updated at the end of every garbage collection, not at each allocation. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.

Finalization Survivors

Displays the number of garbage-collected objects that survive a collection because they are waiting to be finalized. If these objects hold references to other objects, those objects also survive but are not counted by this counter. The Promoted Finalization-Memory from Gen 0 and Promoted Finalization-Memory from Gen 1 counters represent all the memory that survived due to finalization.

This counter is not cumulative; it is updated at the end of every garbage collection with the count of the survivors during that particular collection only. This counter indicates the extra overhead that the application might incur because of finalization.

Gen 0 heap size

Displays the maximum bytes that can be allocated in generation 0; it does not indicate the current number of bytes allocated in generation 0.

A generation 0 garbage collection occurs when the allocations since the last collection exceed this size. The generation 0 size is tuned by the garbage collector and can change during the execution of the application. At the end of a generation 0 collection the size of the generation 0 heap is 0 bytes. This counter displays the size, in bytes, of allocations that invokes the next generation 0 garbage collection.

This counter is updated at the end of a garbage collection, not at each allocation.

Gen 0 Promoted Bytes/Sec

Displays the bytes per second that are promoted from generation 0 to generation 1. Memory is promoted when it survives a garbage collection. This counter is an indicator of relatively long-lived objects being created per second.

This counter displays the difference between the values observed in the last two samples divided by the duration of the sample interval.

Gen 1 heap size

Displays the current number of bytes in generation 1; this counter does not display the maximum size of generation 1. Objects are not directly allocated in this generation; they are promoted from previous generation 0 garbage collections. This counter is updated at the end of a garbage collection, not at each allocation.

Gen 1 Promoted Bytes/Sec

Displays the bytes per second that are promoted from generation 1 to generation 2. Objects that are promoted only because they are waiting to be finalized are not included in this counter.

Memory is promoted when it survives a garbage collection. Nothing is promoted from generation 2 because it is the oldest generation. This counter is an indicator of very long-lived objects being created per second.

This counter displays the difference between the values observed in the last two samples divided by the duration of the sample interval.

Gen 2 heap size

Displays the current number of bytes in generation 2. Objects are not directly allocated in this generation; they are promoted from generation 1 during previous generation 1 garbage collections. This counter is updated at the end of a garbage collection, not at each allocation.

Large Object Heap size

Displays the current size, in bytes, of the Large Object Heap. Objects greater than 20 KB are treated as large objects by the garbage collector and are directly allocated in a special heap; they are not promoted through the generations. This counter is updated at the end of a garbage collection, not at each allocation.

Promoted Finalization-Memory from Gen 0

Displays the bytes of memory that are promoted from generation 0 to generation 1 only because they are waiting to be finalized. This counter is not cumulative; it displays the value observed at the end of the last garbage collection.

Promoted Finalization-Memory from Gen 1

Displays the bytes of memory that are promoted from generation 1 to generation 2 only because they are waiting to be finalized. This counter is not cumulative; it displays the value observed at the end of the last garbage collection. This counter is reset to 0 if the last garbage collection was a generation 0 collection only.

Promoted Memory from Gen 0

Displays the bytes of memory that survive garbage collection and are promoted from generation 0 to generation 1. Objects that are promoted only because they are waiting to be finalized are not included in this counter. This counter is not cumulative; it displays the value observed at the end of the last garbage collection.

Promoted Memory from Gen 1

Displays the bytes of memory that survive garbage collection and are promoted from generation 1 to generation 2. Objects that are promoted only because they are waiting to be finalized are not included in this counter. This counter is not cumulative; it displays the value observed at the end of the last garbage collection. This counter is reset to 0 if the last garbage collection was a generation 0 collection only.

See Also

Reference

Runtime Profiling

Concepts

Automatic Memory Management

Other Resources

Performance Counters in the .NET Framework