Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

stGC

Classes, interfaces and records

classeGCException

inherits from Exception

(no public members)

classeGCUnsupportedClass

inherits from eGCException

(no public members)

classtGCManager

(no public members)

interfaceiGCField

Strong Managed fields of managed classes MUST be declared as iGCField.

function GetInstance: TObject;

interfaceiGCWeakField

Weak Managed fields of managed classes MUST be declared as iGCField.

function GetInstance: TObject;

interfaceiGCInternal

Any managed class that might hold strong references to other instances of any managed class MUST either implement the iGCInternal interface or descend from tGCAbstractObject. The tGCManager will use this interface for walking reference paths

procedure Lock; procedure Unlock; procedure InitializeLock; procedure FinalizeLock;

classeGCDestruction

inherits from eGCException

(no public members)

classeGCIllegalInstruction

inherits from eGCException

(no public members)

classeGCReference

inherits from eGCException

(no public members)

classtGCAbstractObject

inherits from TObject

implements IUnknown, iGCField, iGCWeakField

constructor Create(aMode: tGCCreateAcquiredMode = gcamCreateAcquired);
Use the Create constructor for creating an instance that is directly assigned to an external variable. Full description »
function __ObjAddRef: Integer; override;
Always returns 1.
function __ObjRelease: Integer; override;
Always returns 1.
procedure AfterConstruction; override; procedure BeforeDestruction; override; class function NewInstance: TObject{$IFDEF AUTOREFCOUNT} unsafe {$ENDIF}; override; procedure FreeInstance; override; function Acquire: Integer;
Call Acquire when assigning an instance to another external variable. Each call to Acquire must be matched by a call to Release
function HardRelease: Integer;
Each call to Release must be matched by a prior call to CreateAcquired or Acquire

interfaceiGCProtected

The iGCProtected interface must be used internally by the methods of managed classes. Use the tGCManager.GetGCObject method for obtaining the iGCObject interface of an instance of a managed class. Managed classes SHOULD declare wrapper methods with public visibility for Acquire and Release, and MUST implement _AddRef and _Release to call Acquire and Release if they support interfaces for external use (i.e. except managed fields, which must be declared as iGCField).

function Acquire: Integer; function HardRelease: Integer; procedure DoCreate; procedure DoDestroy; procedure IgnoreFirstAcquire;

recordtGCHeader

fVTable: Pointer; fRefCount: Integer; fFiller: Integer; fNextLive: pGCHeader; fNext: pGCHeader;

classtGCManager

constructor Create; destructor Destroy; override; class function GCAqcuireDefault: Integer; class function GCReleaseDefault: Integer; class function GetDefault: tGCManager;
Returns the value of gDefaultManager.
function GCNewInstance(aClass: TClass): TObject{$IFDEF AUTOREFCOUNT} unsafe {$ENDIF};
To be called by NewInstance of the garbage collected class
procedure GCFreeInstance(aObject: TObject);
To be called by FreeInstance of the garbage collected class
class function GetGCObject(aObj: {$IFDEF AUTOREFCOUNT}Pointer{$ELSE}TObject{$ENDIF}): iGCProtected;
GetGCObject returns a weak reference to a iGCProtected interface corresponding to aObj. The aObj instance MUST have been allocated using GCNewInstance. GetGCObject should only be called from within methods of aObj itself.
procedure Sweep;
Call Sweep to collect unreachable objects
procedure BeginSweepDeferral;
SWEEPS DEFERRED ON THE CALLING THREAD, for a teardown that frees many objects which each sweep on their way out. Full description »
procedure EndSweepDeferral; procedure ClearCache; procedure SetCacheCapacity(aNewCapacity: Integer); procedure SetBlockGranularity(aNewGranularity: Integer); property CacheCapacity: Integer read fCacheCapacity; property ObjectCount: Integer read fObjectCount; property LiveObjectCount: Integer read fLastLiveObjectCount; property UseLocks: Boolean read fUseLocks; function SetUseLocks(aUseLocks: Boolean): Boolean; property SuspendNewInstanceDuringSweep: Boolean read fLockNewInstance; procedure SetSuspendNewInstanceDuringSweep(aSuspend: Boolean); procedure SuspendSweep; procedure ResumeSweep; procedure LockBeforeSweep; procedure UnlockAfterSweep; function LockBeforeNewInstance: Boolean; procedure UnlockAfterNewInstance(aLocked: Boolean); procedure LockBeforeWeakAccess; procedure UnlockAfterWeakAccess; procedure SafeAssignWeakFieldInterface(var aDest; const aSource: iGCWeakField); function SafeGetWeakField(var aSource: iGCWeakField; const aIID: TGUID; out aRef): Boolean; property IsInSweep: {$IFDEF PUREPASCAL}LongBool{$ELSE}Boolean{$ENDIF} read fInSweep;

classtGCMREW

constructor Create(aManager: tGCManager; aHasWeakFields, aUseLock: Boolean); destructor Destroy; override; procedure BeginRead(aMode: tLockModes); procedure EndRead(aMode: tLockModes); procedure BeginWrite(aMode: tLockModes; var aHasLock: tLockModes); overload; procedure BeginWrite(aMode: tLockModes); overload; procedure EndWrite; overload; procedure EndWrite(aMode: tLockModes); overload;

Types (enumerations, sets, aliases)

typeQWORD

  QWORD = UInt64;

typePQWORD

  PQWORD = ^QWORD;

enumtGCCreateAcquiredMode

  tGCCreateAcquiredMode = (gcamCreateAcquired,gcamFirstAssignment);

enumtGCReferenceKind

  tGCReferenceKind = (gcrkStrong,gcrkWeak);

typeIntPtr

  IntPtr = Integer;

typeIntPtr

  IntPtr = Int64;

typepGCHeader

  pGCHeader = ^tGCHeader;

enumtLockMode

  tLockMode = (lmField,lmCreate,lmWeak,lmLockAlways);

settLockModes

  tLockModes = set of tLockMode;

Routines