I'm not clear about closing references in this case:
I have a reference to a control that is really a cluster of buttons.
I have a subroutine that reads each button and returns an array of booleans that says if the button has been pressed. In the subroutine I use the "Controls[]" property to get a control reference to each button.
Do I need to close each of the control references in the array from "Controls[]" before I leave my subroutine?
According to what I have learned recently, you MUST close references explicitly. LabVIEW keeps them open until you either close them explicitly, or quit LabVIEW.
Granted the hit isn't that bad normally, but if you put an open reference in a loop, and run it for days, you can eventually run out of memory, so I hear.
It is absolutely correct that you must close references explicitly. A VI that I've used takes the control references from a cluster of booleans in order to get the label names. Another user noticed that, unless the references were explicitly closed, that memory was never reclaimed. Since this VI was used to determine the next state in a state machine, a memory leak occurred and the program would eventually crash.
Underflow, plese review this document "How Does ActiveX Server Automation Differ from ActiveX Controls?" from NI KnowledgeBase (http://digital.ni.com/public.nsf/websearch/53BAD0DF6128E846862568E7006E2DF7?opendocument&Submitted)
Labviewguru, plese review this document "How Does ActiveX Server Automation Differ from ActiveX Controls?" from NI KnowledgeBase (http://digital.ni.com/public.nsf/ websearch/ 53BAD0DF6128E846862568E7006E2DF7?opendoc ument&Submitted)
Not sure I am clear myself, but if all you are trying to do is read a cluster of booleans to find an array of booleans for which buttons are true, then all you have to do is convert the cluster to an array, and you will have an array of booleans to match your cluster. If that is your intent, it would seem to me to be the easier way to go.
"Bmarsh" wrote in message news:5065000000080000002F290000-993342863000@exchange.ni.com... > I'm not clear about closing references in this case: > > I have a reference to a control that is really a cluster of buttons. > > I have a subroutine that reads each button and returns an array of > booleans that says if the button has been pressed. In the subroutine > I use the "Controls[]" property to get a control reference to each > button. > > Do I need to close each of the control references in the array from > "Controls[]" before I leave my subroutine? > > Thanks > > Brad