Showing results for 
Search instead for 
Did you mean: 

Memory Leak with Named Notifier

Go to solution

I don't usually use named queues or notifiers, but it seemed convenient for a recent task to use named notifiers. My program would use the named notifier once every 10 mins, and after a couple days of running, the program would get a memory error. I cannot prove the memory error is from the notifiers in the program so I made a simple test case, attached.


I made "Notifier" to send data on a named notifier every 5ms, but only a single notifier should ever be created. If I run the "Notifier", the memory usage starts out constant, then starts to trend upward in a straight line after about 5 minutes. After about 30 minutes of running, the notifier no longer transfers data and the data indicator just reads 0. You can use the included "Check Memory" to see a chart of the memory usage over time.


Can anyone reproduce these results? Did I misunderstand how named notifiers work?


Block diagram for those who don't want to download:


0 Kudos
Message 1 of 3
Accepted by topic author Gregory

This is not a bug, rather the expected behavior. Each time you obtain a notifier (even a named one, where you're pointing at the same underlying notifier), you get a new copy of the reference, and every single one of those needs to be closed. So, if you obtain a reference in a loop (as you're doing), but you never close those references, then you get a resource leak.


EDIT: here's one of many posts on this topic, this one from an authoritative source:

Message 2 of 3

I see, thanks for clearing that up!

0 Kudos
Message 3 of 3