Redaguoti

Bendrinti naudojant


ICorProfilerCallback::RootReferences Method

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

Syntax

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

Parameters

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 are called to notify the profiler. Profilers will normally implement one or the other, but not both, because the information passed in RootReferences2 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 is called, all objects have been moved to their new locations and can be safely inspected.

Requirements

Platforms: See System Requirements.

Header: CorProf.idl, CorProf.h

Library: CorGuids.lib

.NET Framework Versions: Available since 2.0

See also