ICorProfilerInfo2::GetGenerationBounds Method

Gets the memory regions, which are segments of the heap, that make up the various garbage collection generations.

HRESULT GetGenerationBounds(
    [in] ULONG cObjectRanges,
    [out] ULONG *pcObjectRanges,
    [out, size_is(cObjectRanges), length_is(*pcObjectRanges)] COR_PRF_GC_GENERATION_RANGE ranges[]);

Parameters

Parameter Description

cObjectRanges

[in] The number of elements allocated by the caller for the ranges array.

pcObjectRanges

[out] A pointer to an integer that specifies the number of ranges returned in the ranges array.

ranges

[out] An array of COR_PRF_GC_GENERATION_RANGE Structure structures, each of which describes a range (that is, block) of memory within the generation that is undergoing garbage collection.

Remarks

The GetGenerationBounds method can be called from any profiler callback, provided that garbage collection is not in progress. That is, it can be called from any callback except those that occur between ICorProfilerCallback2::GarbageCollectionStarted Method and ICorProfilerCallback2::GarbageCollectionFinished Method.

Most shifting of generations takes place during garbage collections; generations might grow between collections, but generally do not move around. Therefore the most interesting places to call this function are in ICorProfilerCallback2::GarbageCollectionStarted Method and ICorProfilerCallback2::GarbageCollectionFinished Method.

During program startup, some objects are allocated by the common language runtime (CLR) itself, generally in generations 3 and 0. Thus, by the time managed code starts executing, these generations will already contain objects. Generations 1 and 2 will normally be empty, except for dummy objects generated by the garbage collector. (The size of dummy objects is 12 bytes in 32-bit implementations of the CLR; the size is larger in 64-bit implementations.) You might also see generation 2 ranges that are inside modules produced by the Native Image Generator (Ngen.exe). In this case, the objects in generation 2 are "frozen objects," which are allocated when Ngen.exe runs rather than by the garbage collector.

Requirements

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: CorProf.idl

Library: CorGuids.lib

.NET Framework Version: 2.0

See Also

Reference

ICorProfilerInfo Interface
ICorProfilerInfo2 Interface