ICorDebugProcess5::EnumerateHeapRegions Method

Gets an enumerator for the memory ranges of the managed heap.

Syntax

HRESULT EnumerateHeapRegions(
   [out] ICorDebugHeapSegmentEnum **ppRegions
);

Parameters

ppRegions [out] A pointer to the address of an ICorDebugHeapSegmentEnum interface object that is an enumerator for the ranges of memory in which objects reside in the managed heap.

Remarks

Before calling the ICorDebugProcess5::EnumerateHeapRegions method, you should call the ICorDebugProcess5::GetGCHeapInformation method and examine the value of the areGCStructuresValid field of the returned COR_HEAPINFO object to ensure that the garbage collection heap in its current state is enumerable. In addition, the ICorDebugProcess5::EnumerateHeapRegions method returns E_FAIL if you attach too early in the lifetime of the process, before memory regions are created.

This method is guaranteed to enumerate all memory regions that may contain managed objects, but it does not guarantee that managed objects actually reside in those regions. The ICorDebugHeapSegmentEnum collection object may include empty or reserved memory regions.

The ICorDebugHeapSegmentEnum interface object is a standard enumerator derived from the ICorDebugEnum interface that allows you to enumerate COR_SEGMENT objects. Each COR_SEGMENT object provides information about the memory range of a particular segment, along with the generation of the objects in that segment.

Requirements

Platforms: See System Requirements.

Header: CorDebug.idl, CorDebug.h

Library: CorGuids.lib

.NET Framework Versions: Available since 4.5

See also