Showing results for 
Search instead for 
Did you mean: 

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

Go to solution


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

Personally, I do not think they are a problem. I use a similar architecture to the one here


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.





0 Kudos
Message 2 of 16

FYI If you have not seen this


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



Message 3 of 16
Accepted by 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

Thanks to both of you for the useful info! 🙂

0 Kudos
Message 5 of 16

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

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

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

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.




Video (FTP and under NIWeek 2013)

Message 9 of 16

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