Muokkaa

Jaa


ICorProfilerCallback2::GarbageCollectionStarted Method

Notifies the code profiler that garbage collection has started.

Syntax

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

Parameters

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

generationCollected
[in] An array of Boolean values, which are true if the generation that corresponds 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, which indicates the generation.

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

Remarks

All callbacks that pertain to this garbage collection will occur between the GarbageCollectionStarted callback and the corresponding ICorProfilerCallback2::GarbageCollectionFinished callback. These 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 callback.

Requirements

Platforms: See System Requirements.

Header: CorProf.idl, CorProf.h

Library: CorGuids.lib

.NET Framework Versions: Available since 2.0

See also