IForeGarbageCollector.RequestFullClean

Syntax

RequestFullClean([MaxDuration: Integer = -1]);

Parameters

MaxDuration. Garbage collection time in seconds.

Description

The RequestFullClean method starts a full cycle of garbage collection.

Comments

Unlike the RequestPartitialClean method that executes only one iteration of garbage collection, RequestFullClean will repeat memory cleaning until all non-used objects are deleted. For example, there is an object B that depends on an object A. The object A is marked as a non-used one. After executing the RequestPartitialClean method the object A is deleted from memory, and the object B is kept. Executing the RequestFullClean method deletes the object A after the first iteration, the object B is deleted after the second iteration, and so on.

The MaxDuration parameter is not set by default; garbage is collected until memory contains only the objects that are marked as used ones. If the MaxDuration parameter is set, and the garbage collector does not manage to finish its work in the specified time, the process is paused and resumed on repeated calling of the method, or under the conditions required for automatic startup of garbage collection.

Example

Sub UserProc;
Var
    GC: IForeGarbageCollector;
Begin
    GC := 
New ForeGarbageCollector.Create;
    GC.RequestFullClean(
1);
End Sub UserProc;

Executing the example starts a full cycle of garbage collection. Garbage collection will last one second.

See also:

IForeGarbageCollector