LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Housekeeping references

If I open a reference to a VI, then from there get a reference to the front
panel and then an array of references to all the controls, will closing the
reference to the VI automatically clean up all the other references? Surely
I don't need to go through the array of controls afterwards closing them
all, although I seem to recall doing it in a previous VI just to be safe.
0 Kudos
Message 1 of 3
(2,725 Views)
Craig,

You should not have to close all of the refrences independently. LV will keep track of the VI, Panel, control references, etc... and close them when the VI is unloaded from memory.
As a word of warning. This behavior is for VI class only. If you do any work with ActiveX class, you will have to close each reference you create.
0 Kudos
Message 2 of 3
(2,725 Views)
Yeah, certainly they're unloaded from memory at the end of execution,
however a while back I wasn't closing all my VI references and ran into
difficulties.

I had a program that periodically opened a VI reference to another VI and
did something, I can't remember what now. This was a "daemon" type program
that simply ran all the time in the background while some kit was operating,
and after a few days I lost the ability to open any new references from any
VI. In addition, when shutting Labview down to try and recover, it'd appear
to hang and I rebooted a few times before discovering that if I left it it
came back after maybe half an hour.

I now know that some internal table filled with these refnums, preventing
any more being opened and taking half an hour or so for Labview to empty on
shutting down, but it was a sod to find at the time- especially as it wasn't
a program I wrote.

This has made me worry about what happens to such references- say you
repeatedly open a reference to another VI then open a reference to a control
on that VI. Obviously if you don't close them at all, the above scenario
occurs which may not be a problem in a light application but certainly is in
a complex and continuously running one. What I've been doing is, after each
operation, closing all the refnums in the order in which I opened them, but
this gets messy on the diagram. What would be nice is if I could close the
"top level" reference and know that all the references that have been opened
from it will also be closed, which means you only need one close node. But
without definite confirmation that this is what happens, I don't want to end
up with another intermittent problem caused by zombie references.


gsussman wrote in message
news:101-50650000000500000036170000-981958153000@quiq.com...
> Craig,
>
> You should not have to close all of the refrences independently. LV
> will keep track of the VI, Panel, control references, etc... and close
> them when the VI is unloaded from memory.
> As a word of warning. This behavior is for VI class only. If you do
> any work with ActiveX class, you will have to close each reference you
> create.
0 Kudos
Message 3 of 3
(2,725 Views)