03-03-2010 01:30 AM
Hi all,
I am working with notifiers and queues in multiple VIs. I have strange behaviours, when I store the queue and notifier references in global variables.
I have read some entries in this forum, and some says, it is a "bad idea", that "should not be done", to store the refs in globals.
Can anybody tell me, what is the real background?
regards
mitulatbati
Solved! Go to Solution.
03-03-2010 01:37 AM
Besides that globals are simply evil (just slightly an over the top statement as I really advocate to minimize the use of globals to nothing more than a status boolean or sometimes some single skalar value), all LabVIEW refnums employ some garbage collection.
The reason to use globals usually implies that you want to create the according resource at one place and use it someplace else. But that often does not work with LabVIEW refnums if the producer and consumer are not in the same VI hierarchy (for instance you create the resource in a startup VI and then spawn a plugin VI that continues while the startup VI terminates). All LabVIEW refnums are automatically disposed at the moment the top level VI in whose hierarchy the refnum was opened goes idle. So at the time your plugin VI gets to work, the refnum and its object has been already disposed and is therefore invalid.
03-03-2010 01:53 AM