Collect

Requests a .NET garbage collection.

This function is exported by the KS module.

Collect()

Remarks

Well-structured scripts rarely need this function. A collection does not finalize an object which is still reachable, and local variables can remain reachable until their function returns even after the script assigns another value to them.

If a resource must be released immediately, call its explicit close/dispose method or, when appropriate, its __Delete method rather than relying on collection timing.

Object Lifetime