06-23-2015 06:44 AM
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.
regards,
Andrey.
06-23-2015 06:56 AM
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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
06-23-2015 07:08 AM
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.
06-23-2015 07:22 AM - edited 06-23-2015 07:22 AM
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.......
06-23-2015 07:41 AM - edited 06-23-2015 07:42 AM
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:
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).