Showing results for 
Search instead for 
Did you mean: 

Run-Time Popup Menu can appear only limited number of times, then exception happened

Hello, Colleagues,


Very nice problem was encountered yesterday. I have a control (doesn't matter which one - Vision/Picture or Boolean), where I needed dynamically created Run-Time menu, which is called on Right Mouse Click. The problem is that this menu can be shown only limited number of times, and this depends from amount of the items in the menu. For example, menu with 10 items can be shown roughly 3300 times only. Then exception is coming. Menu with 4 items will cause crash after 8K clicks and so on. If we put 8000 items into menu, then 4 clicks is enough, 5th will cause exception. Memory leak is also observed. Exception happened in Insert Menu Items primitive.


Was checked in LabVIEW 2010 and 2014. Both are affected (Dev environment and Run-Time).


Here is short video with explanation:



The test project in attachment.


The question is - do you have any idea about "low cost" workaround (except using WinAPI or self-made menus)? The requirement is - this menu should be generated at run-time, because could be different from run to run.





Message 1 of 5

Wow looks like a bug.  Just curious, how did you find this?  It seems that even with a UI that is heavy on the right clicking, getting that many right clicking menu items would take a very long time to see.  And then to take the time to troubleshoot and figure out what was causing a massive crash like that.  I'm guessing it was a program that ran for a very long time without any problems.

0 Kudos
Message 2 of 5

Hooovahh, this is industrial application which is running 24/7. Some customers reported, that the application rarely crashed on right mouse click. I made "help" application which simulates user input in the cycle (SetCursorPos/mouse_event) and after some overnight tests got it.

0 Kudos
Message 3 of 5

Uff. 8kx4 is a very suspicious number.  It would lead to believe that somewhere in the background an I16 value is wrapping, causing an exception.


I would guess that you can open a maximum number of 32768 items int he menu before it crashes.......

0 Kudos
Message 4 of 5

Yes, Intaris, its true. Definitively looks like I16 or may be U16 counter (I have "two-levels" menu).

In additional, every time when huge menu is appeared, then memory allocated, but not released:

23-06-2015 14-35-28.png

with small menu memory leakage is moderate, but when numer of items is huge, then can be clearly observed.

My first idea was to use Close Reference, but unfortunately Close Reference cannot be directly used for Menu Reference (even if can - not sure if this help).


0 Kudos
Message 5 of 5