LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Under what conditions is it safe to not close a reference?

I am curious whether there are certain conditions where references will be automatically closed. Especially with ActiveX projects, the number of references that are opened can get very large. When I look at VB code, I see references created by initializing variables, but I don't anything explicitly closing them. Is it necessary to always close the references used in LabVIEW manually?
0 Kudos
Message 1 of 2
(2,118 Views)
For ActiveX, you must always close the reference to avoid leaks while running. Remember that an ActiveX reference is really an IUnknown pointer under the covers, which requires the AddRef() and Release() methods to be invoked (COM is a reference counting model). VB handles it for you automatically by its internal garbage collector.

LabVIEW will automatically clean up the reference when the top-level VI goes idle but not until then.
Message 2 of 2
(2,114 Views)