Garbage collection is important in some specific cases, when the system cannot delete an object automatically because of some systematic criteria. For example, when there are two unused objects (A and B) in the system, linked to each other, the system cannot delete them, as their link counter is not null. To resolve such problems, the system executes periodic garbage collection.
Garbage is collected in a separate thread (a separate thread is initialized for each repository connection). By default, the following strategy is used: garbage is collected if application methods are not currently executed; it is checked if garbage collection is possible each two seconds. If required, the strategy can be changed using registry keys.
The following keys can be created in the registry branch [HKEY_CURRENT_USER\Software\Foresight\Foresight Analytics Platform\9.0\Fore]:
Parameter | Description |
GCStrategy (DWORD) | Garbage collection strategy. A binary one-byte number cast to decimal view is set as a value. The first three bytes of the number are not used. The other five bytes are used to enable the following modes:
Various modes can be combined. The default mode corresponds to the 00001001 number in the binary system or 9 in the decimal system. |
GCInterval (DWORD) | Time interval of checking if garbage collection is possible. The value is set in milliseconds. |
Changing of garbage collection strategy may slow down code execution and the whole developed application. Disabling of garbage collection and force calling of methods of the IForeGarbageCollector interface may be relevant when the developer is sure when resource-intensive processes are executed, after which memory may contain non-used objects. Permanent garbage collection (the 00000010 mode) may be required on computers with a small virtual memory when it may be overflowed quickly.
See also: