cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

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

Solved!
Go to solution

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

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 10
(511 Views)

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

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 10
(495 Views)

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

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 10
(476 Views)
Highlighted
Solution
Accepted by topic author Blokk
07-14-2017 10:35 AM

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

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

 

Unhandled Events.png

Matt J
National Instruments | CLA/CTD
You May Not Know
Message 4 of 10
(473 Views)

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

Thanks to both of you for the useful info! Smiley Happy

0 Kudos
Message 5 of 10
(464 Views)

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

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 10
(374 Views)

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

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/CTD
You May Not Know
0 Kudos
Message 7 of 10
(371 Views)

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

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 10
(364 Views)

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

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/


Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
Interesting in learning all you can about automotive CAN bus communicatin? Checkout my 9 part CAN Blog series.

Message 9 of 10
(321 Views)

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

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 10
(295 Views)