PurgeReleasedAPIObjects Method


Application Purge Released APIObjects Method

Explicitly purges all API objects that have been released but are still awaiting to be finalized

Namespace: Autodesk.Revit.ApplicationServices
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public void PurgeReleasedAPIObjects()
Remarks
Revit purges API objects automatically every time when command control returns from an API application (an external command, event handler, etc.) back to Revit. This is necessary because Revit does not allow API objects to be finalized when the finalization is invoked from an outside thread (from the garbage collector, specifically). This automatic purging is adequate in most scenarios. When an application uses a lot of API objects during one single command though, it may be necessary or beneficial to invoke an additional purge explicitly to free the deleted API objects from memory.
See Also
ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →