LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

closing dynamic run-time menu reference

I make use of customized run-time menus (RTM) on some of my contols.  In addition, in order to dynamically enable\disable\check\uncheck menu items for different conditions, I use the "Shorcut Menu Activation?" filter event to control the menu choices that the user can make before handling the actual choice in a "Shortcut Menu Selection (User)?" notify event.  All of this works as expected.

However, I've noticed that since the RTM referneces are dynamically created in the filter event, each time the event is called a different refnum is created.  This is confirmed by a probe on the menu refnum, which shows a different number every time the use right-clicks on the control.  My question is if LV automaically closes these references after the filter event is finished, or if I have to close them myself.  I've tried using the "Close Reference" primative, but it produces a wire-type conflict with menu refnums.

I'm primarily worried about memory leaks over time.  Am I worried for no reason?
Message 1 of 2
(2,690 Views)
My guess is it would be ok if you didn't close the reference. LabVIEW has a
very good garbage collector, when it comes to native references.

The control menus reuse the VI menu reference functions. And you can't close
a VI menu reference, so there is no close for it. These references are
different from the normal references, that you can wire to a property node
or invoke node. Since you can't close it, I asume it's done automatically.

One way to test if you need to somehow close it, is to see if LabVIEWs
memory increases if you create a number of menus.

Regards,

Wiebe.


Message 2 of 2
(2,668 Views)