DoDotNetGarbageCollection Method

TestStand 2019 Help

Edition Date: May 2019

Part Number: 370052AA-01

»View Product Info
Download Help (Windows Only)

Syntax

Engine.DoDotNetGarbageCollection ( reserved = 0)

Purpose

Forces .NET garbage collection and waits for pending finalizers to ensure that all unreferenced COM objects that have ever been referenced in .NET in the TestStand process are synchronously freed.

For example, if you are handling events from any of the TestStand User Interface (UI) controls in a .NET user interface, .NET references all the parameters to all the events for the TestStand UI Control. The lifetimes of these parameters are extended until garbage collection occurs. When you use .NET to handle any event on an ActiveX control, such as a TestStand UI Control, the .NET Framework handles all events for that control even if you do not handle the events directly in code.

In addition, if sequences pass TestStand interface objects as parameters to .NET code modules, .NET references those parameters, which extends the lifetimes of those parameters until garbage collection occurs.

Remarks

You typically do not need to call this method because TestStand automatically calls this method at various critical points, such as when an execution completes or when a sequence file or execution closes.

Note  The garbage collection this method performs applies only to the version of the .NET CLR the TestStand Engine uses directly. To ensure objects from another .NET CLR version are destroyed, such as when you implement a user interface in a different version of the .NET CLR, call the System.GC.Collect and System.GC.WaitForPendingFinalizers .NET Framework methods in that version of the .NET CLR.

Parameters

reserved As Long

[In] Reserved for future use. You must always pass 0 for this parameter.

This parameter has a default value of 0.


See Also

Engine.DotNetCLRVersion

Engine.DotNetGarbageCollectionInterval

Managing Versions of .NET to Use with TestStand

WAS THIS ARTICLE HELPFUL?

Not Helpful