From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When and which references to close

Solved!
Go to solution

**I posted the same in the TestStand forum. A moderator can erase the one that is in the wrong forum**

 

Hi, I'm modifying the (LabVIEW) Teststand Simple User Interface and I have a couple of questions.

1. Is the order of the References-Closing important?

2. Should I close all References?

 

I think the Entry Pont 1 Button and the GetSequenceFileEx References are unnecesary to close the SequenceFileViewer Manager and the TestStand Engine references.nueva.PNGnueva2.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

What do you think?

 

 

 

 

 

=======
My Channel: https://www.youtube.com/@LV_Lab

0 Kudos
Message 1 of 2
(2,238 Views)
Solution
Accepted by AldhairGarza
  1. Generally no, the order is not important. As long as you are closing all your references in one go and another thread isn't using that reference (your example doesn't show that particular case so I think you're ok).
  2. The large majority of the time there's no harm in closing all the references you obtain and in fact I would say that you should just always do so once you know you are finished working with it. Some static references are simply no-ops. ActiveX references are ref-count based so you closing the reference doesn't always release the object - it depends on whoever else has an active reference. In your case your VI (and the run-time) is hosting the TS ActiveX controls and their reference to the engine, so I would agree with the strategy in your Shutdown case.

If your "references" clusters only contain ActiveX references then I think you can convert the cluster -> array and then just pass the array to the Close Reference node directly (it supports closing multiple references in on go) - I don't have LV at the moment to check that the conversion to array succeeds.

Message 2 of 2
(2,192 Views)