09-05-2012 04:37 PM - edited 09-05-2012 04:41 PM
I must be forgetting something very basic about queue references. Here's my problem.... I have a LabVIEW application that dynamically generates Q's. (A queue is generated in order to act as a dedicated datastream for each created graph). The queue references are created and stored by a functional global (FG - Queue Manager.vi). This functional global is called by the "Launcher" and the "Monitor". Everything works great until the Launcher is closed at which point the queue references show "Invalid Refnum". The reference is still in memory because the Functional Global is still in memory being called by the Monitor so why are my Q references turning invalid? See attached example LV2010sp1.
Solved! Go to Solution.
09-05-2012 09:26 PM
See Rolf's response in this thread
09-06-2012 09:32 AM
Thanks for the info. This was the conclusion I ended up on but could not find any documentation to back it up (other than "Q Refs opened by Top-level VIs will be close automatically when the Top-level VI is closed" or something like that. I thought I beat this problem by using a functional global. This design is annoying but I understand it now. I wish LabVIEW took more of a C++ approach and allowed me to do my own garbage collection. Or even have an option on the "obtain Q" that allowed me to keep the Q ref in memory as long as the application instance was valid. Thanks again for you help.
09-06-2012 09:48 AM
As long as the hiearchy that created the ref stays active the queue will remain active.
Ben
09-06-2012 10:07 AM
@craige wrote:
. I wish LabVIEW took more of a C++ approach and allowed me to do my own garbage collection
Be careful with this term, as LabVIEW does not have a garbage collector in the common sense, and saying this will make Aristos Queue's head spin. However, why not have the functional global open the queue reference and add the reference to the FG in your dynamically launched VI, instead of doing all that in the VI doing the launching? Could you give us any more insight on your architecture and why you have done it the way you have, and maybe we can give you a better way to handle what you're trying to do.
09-06-2012 10:10 AM
@for(imstuck) wrote:
... However, why not have the functional global open the queue reference and add the reference to the FG in your dynamically launched VI, instead of doing all that in the VI doing the launching? Could you give us any more insight on your architecture and why you have done it the way you have, and maybe we can give you a better way to handle what you're trying to do.
Re: Maybe we can...
You just did.
Ben