methodtGCManager.BeginSweepDeferral
procedure BeginSweepDeferral;
SWEEPS DEFERRED ON THE CALLING THREAD, for a teardown that frees many objects which each sweep on their way out. Every Sweep marks the whole heap, live objects included, so a run of such frees pays for the entire live graph once per free where once in total collects the same garbage. Between BeginSweepDeferral and the matching EndSweepDeferral a Sweep called on this manager from this thread returns at once and is remembered, and the outermost EndSweepDeferral then sweeps twice if any was asked for - two passes, as every caller of Sweep does, because an object that becomes unreachable while a pass runs is found by the next. Pairs nest. Other threads sweep as they always do, and so does a manager other than the one the outermost BeginSweepDeferral was called on. The depth belongs to the thread, so EndSweepDeferral goes in a finally.