THYGC

Overview

The THYGC class provides methods for obtaining information about the garbage collection system and for controlling some aspects of garbage collection. For more information please use this MSDN article.

Use Case

You can get access to an instance of this class via global THYClr object. Please note that using this class can affect performance of an application.

uses
  uHYCLRWrappers;

if HYClr <> nil then
  HYClr.GC.Collect(-1);

Location

  • Unit: Hydra.Managed.Wrappers.pas
  • Ancestry: THYGC

Properties


GC

Reference to a Microsoft GC interface.

property GC: IGCHost read write

Instance Methods


constructor Create

Creates a new instance of the object.

constructor Create

Collect

Forces a collection to occur for the given generation, regardless of the state of the current garbage collection.

procedure Collect(Generation: Integer)

Parameters:

  • Generation: The generation on which to perform the garbage collection. A value of -1 indicates that all generations will undergo a garbage collection.

GetStats

Gets the statistics for the current state of the garbage collection system.

function GetStats: _COR_GC_STATS

GetThreadStats

procedure GetThreadStats(var FiberCookie: LongWord; var Stats: _COR_GC_THREAD_STATS)

Parameters:

  • FiberCookie:
  • Stats: