Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/03/2015 in all areas

  1. That's actually covered in that document. Any child references of the front panel are "static" references. When the VI server was pretty new (around LabVIEW 5.1) those were in fact dynamic references that had to always be explicitedly closed. However in a later version of LabVIEW that was changed for performance reasons. If you attempt to close such a reference the Close Reference node is in fact simply a NoOp. This is documented and some people like to go to great lengths to make sure to always know exactly which references need to be closed and which not, in order to not use the Close Reference node unneccessarily but my personal opinion is that this is a pretty useless case of spending your time and energy and simply always using the Close Reference node anyways is the most quick and simple solution. One way to reliably detect if a returned refnum is static or dynamic is to place the node that produces the refnum into a loop that executes at least twice and typecast the refnum into an int32. If the numeric value stays the same then it is a static refnum, otherwise it is dynamic and needs to be closed explicitedly in order to avoid unneccessary resource hogging of the system.
    1 point
  2. So no one has ever told me this, but from what I've seen child references won't be closed using a close reference, if a parent is forcing them to stay open. Make a new VI, drop down a control of any kind. Right click and create a static reference to that control. Use the Close Reference on that reference, then use a property node to read the label text of the control, passing the error out of the Close Reference into the error in of the property node. Now run the VI. The label is still returned, and the reference is still valid even through you asked to close it. This is because even though you asked to close the reference, it needed to be open because the VI that uses it is still in memory. Reading the detailed help on the close reference function has more information on this. This might also be compounded by the fact that I think this is an example of a "This" reference. So closing the control reference in my mind does nothing, unless you explicitly opened the reference using the Open VI Object Reference. So if you opened a reference to a VI, then used a property node to return the control references on the front panel. Then it is my understanding that you don't need to close the control references, when you are done. All you need to do is ensure the VI reference you opened gets closed. As a fun test I'll usually write a simple VI that does my work and closes the things I think it needs to close, then use the Run Continuous button and look at the task manager and see if memory increases. This is the only time I find myself using this button.
    1 point
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.