LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Inspector Window - Unhandled Events: "how bad" are they?

Solved!
Go to solution

Hello,

Just a general question: are unhandled events bad? Do they introduce a memory leak? Being lazy, I just bundled my 4 User Events into a typdef cluster, and I used it through my whole project, like in dynamically called VIs, and some subVIs too. So I just registered for all of these 4 Events in every Event Structure.

 

There is not a single VI in my project where I need all of the 4 User Events to be used in the actual Event Structure of the VI, so of course this approach caused lots of unhandled events (visible using the Event Inspector Window). I am not sure if unhandled events can cause problems after longer runtime? I guess memory leaks?

Anyway, I cleaned up my project, and now I only register EVERY Event Structure for those User Events which are actually handled in their cases. So I do not see "unhandled events" any more in this Event Inspector Window.

 

So practically my question is that, how bad are these unhandled events? One of the User Event was generated at every sec (data broadcast to some modules from a DAQ loop).

Message 1 of 16
(6,786 Views)

Personally, I do not think they are a problem. I use a similar architecture to the one here  https://decibel.ni.com/content/docs/DOC-12159

 

I send my events everywhere and then a helper loop sends them to a local loop. I believe there are no memory leaks, but, if you have a tight loop, you will be receiving a bunch a messages that you end up ignoring, which will slow down the loop slightly. That is why I use the helper loop.

 

cheers,

mcduff

 

0 Kudos
Message 2 of 16
(6,770 Views)

FYI If you have not seen this https://github.com/JackDunaway/LabVIEW-User-Events-Tips-Tricks-and-Sundry

 

I highly suggest it, extremely useful information. I believe it shows no memory leaks also.

 

mcduff

Message 3 of 16
(6,750 Views)
Solution
Accepted by topic author Blokk

At one point I incorrectly posted that unhandled events caused problems but was corrected.

 

Unhandled Events.png

Matt J | National Instruments | CLA
Message 4 of 16
(6,747 Views)

Thanks to both of you for the useful info! 🙂

0 Kudos
Message 5 of 16
(6,738 Views)

Hmmm, I'm not sure the stated information from Craig S. is correct about event structures automatically discarding events they have not been registered for.  I would actually view this as a bug.

 

It doesn't match my testing history at all.  Mind you, I utilise almost exclusively UserEvents, and maybe it's a difference if we're talking about Control Events or UserEvents......

0 Kudos
Message 6 of 16
(6,648 Views)

If you have a VI that shows that they are not discarded I would be interested in seeing it. You are correct that the above statement is for dynamically registered user events and not those of front panel controls although I would not expect them to be different.

Matt J | National Instruments | CLA
0 Kudos
Message 7 of 16
(6,645 Views)

I have just tested it and it is indeed exactly as mentioned, an Event structure deletes all registered events which it is not told to handle.

 

But I'm not sure I'd put this in the "feature" box, for me it's a bug.  It's actually a bug I've spent time working around (i.e. making sure all UserEvents ARE being handled in order to prevent memory leaks) only to find out now that this can never actually lead to memory leaks......

 

So if I have code where two event structures are wired up in series with the same Registration Refnum but handle only some in the first structure and the "rest" (which by this time no longer exists) in the second then the second event structure never actually sees anything because the first has decided to discard all of the otherwise perfectly valid events.

 

So I learned something valuable today.

Message 8 of 16
(6,638 Views)

I remember Jack Dunaway giving a presentation at NI Week 2013 that had lots of goodies on Events.  One of the things I remember him touching on is there were a few cases where memory leaks could occur in 2012 that were then fixed in later versions.  One was generating events that no one was registered for.  I know this doesn't directly answer the question (that's already been answered) but Jack had a lot of good info and it is worth a watch since it was recorded.

 

Content:

https://github.com/JackDunaway/LabVIEW-User-Events-Tips-Tricks-and-Sundry

 

Video (FTP and under NIWeek 2013)

https://lavag.org/topic/16091-ni-week-2012-videos/

Message 9 of 16
(6,595 Views)

I remember the presentation and I remember my mind being blown.

 

The fix for memory leaks is not something which stuck with me unfortunately.  Still, a day where I learn something (even if it's for the second time) is not a wasted day.

0 Kudos
Message 10 of 16
(6,569 Views)