Freigeben über


ICorProfilerCallback2::GarbageCollectionStarted Method

Notifies the code profiler that garbage collection has started.

HRESULT GarbageCollectionStarted(
    [in] int cGenerations,
    [in, size_is(cGenerations), length_is(cGenerations)] BOOL generationCollected[],
    [in] COR_PRF_GC_REASON reason);

Parameters

Parameter Description

cGenerations

[in] The total number of entries in the generationCollected array.

generationCollected

[in] An array of Boolean values, which are true if the generation corresponding to the array index is being collected by this garbage collection; otherwise, false.

The array is indexed by a value of the COR_PRF_GC_GENERATION Enumeration enumeration, indicating the generation.

reason

[in] A value of the COR_PRF_GC_REASON Enumeration enumeration that indicates the reason the garbage collection was induced.

Remarks

All callbacks pertaining to this garbage collection will occur between the GarbageCollectionStarted callback and the corresponding ICorProfilerCallback2::GarbageCollectionFinished Method callback. The corresponding GarbageCollectionStarted and ICorProfilerCallback2::GarbageCollectionFinished Method callbacks need not occur on the same thread.

It is safe for the profiler to inspect objects in their original locations during the GarbageCollectionStarted callback. The garbage collector will begin moving objects after the return from GarbageCollectionStarted. After the profiler has returned from this callback, the profiler should consider all object IDs to be invalid until it receives a ICorProfilerCallback2::GarbageCollectionFinished Method callback.

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
ICorProfilerCallback2 Interface