LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

close reference from event data node

When using an event structure, I often times use the Control Reference output in the Event Data Node.  Do I need to close these references each time the corresponding event fires?  In other words, are the reference created from this node unique each time that particular case is called?
0 Kudos
Message 1 of 2
(2,320 Views)
The Event Structure does not create duplicate references to the same object if the event case is called multiple times, so you don't have to worry about having dozens of open references. You can actually verify this by type-casting your control reference to an I32 to see the exact 32 bit value (or just probe the refnum). Firing the event case multiple times produces the same reference.

You really don't need to worry about closing the reference in this case. In general, LabVIEW will figure out that the control references are no longer valid as soon as the VI goes idle, and it will clean them up. Closing references is good practice if you're going to be opening a large number of references (for instance, getting references to all controls on a large Front Panel), and you don't want them all to stay in memory the whole time.
Jarrod S.
National Instruments
Message 2 of 2
(2,314 Views)