ICorProfilerCallback::RootReferences Method

Notifies the profiler with information about root references after garbage collection.

HRESULT RootReferences(
    [in] ULONG    cRootRefs,
    [in, size_is(cRootRefs)] ObjectID rootRefIds[] );

Parameters

Parameter Description

cRootRefs

[in] The number of references in the rootRefIds array.

rootRefIds

[in] An array of object IDs that reference either a static object or an object on the stack.

Remarks

Both RootReferences and ICorProfilerCallback2::RootReferences2 Method are called to notify the profiler. Profilers will normally implement one or the other, but not both, because the information passed in ICorProfilerCallback2::RootReferences2 Method is a superset of that passed in RootReferences.

It is possible for the rootRefIds array to contain a NULL object. For example, all object references declared on the stack are treated as roots by the garbage collector and will always be reported.

The object IDs returned by RootReferences are not valid during the callback itself, because the garbage collection might be in the middle of moving objects from old addresses to new addresses. Therefore, profilers must not attempt to inspect objects during a RootReferences call. When ICorProfilerCallback2::GarbageCollectionFinished Method is called, all objects have been moved to their new locations and can be safely inspected.

Requirements

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

Header: CorProf.idl

Library: CorGuids.lib

.NET Framework Version: 2.0

See Also

Reference

ICorProfilerCallback Interface