LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

subvi with queues question

Hi,

If you have a subvi that uses queues in a producer consumer pattern for example, and you do not release the queues at the end of the subvi, the next time you use the subvi, will it use the data from that was the queue from the previous usage of the subvi. In otherwords, I basically have a subvi that uses queues inside of it. This subvi is placed in a for loop. One the first iteration of the for loop, the subvi creates a queue and then ends. I do not release the subvi. The next time the subvi executes which is in the second iteration of the for loop will the queues now have data from the previous usage of the subvi in the first iteration of the for loop.

It seems that this is the case, but I am not sure. I just wanted to ask others in the labview community if this is the case. However, I noticed if I just run the subvi as just a regualar vi, meaning running it once, and then waiting for the vi to terminate, and then running it again, the release queue does not seem to be neccessary.

-Tim
0 Kudos
Message 1 of 7
(3,760 Views)
Yes, the data in the queue will remain there until you Dequeue, Flush Queue, or Release Queue.
Message 2 of 7
(3,750 Views)

Adding to the comments made by "Just me".

....

Unless the VI that created the queue goes idle. In which case, LV will clean-up all of the resources associated with that VI.

I discuss a similar situation when using Occurrences in this Nugget.

http://forums.ni.com/ni/board/message?board.id=170&message.id=226491&view=by_date_descending&page=2

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 7
(3,742 Views)
Has anybody else noticed when dealing with huge queues that when the vi goes idle without releasing queue the next time the vi is started it runs slower each time like it fully didn't release the queues memory? Not until labview is shutdown and restarted does it seem like it releases the memory.
0 Kudos
Message 4 of 7
(3,734 Views)
Just me pondered;
 
"
Has anybody else noticed when dealing with huge queues that when the vi goes idle without releasing queue the next time the vi is started it runs slower each time like it fully didn't release the queues memory? Not until labview is shutdown and restarted does it seem like it releases the memory.
"
 
Yep!
 
Since allocating memory and other resource takes a LONG time, LV will defer that work until when there is no chance the resource will be used again. That happens at LV exit.
 
For the most part, if we just close the resource LV can handle things better.
 
I seem to remember a (deallocate as soon as possible) VI or a property node (am I just dreaming again? ) to handle the situation where a dynamically loaded VI uses a big memory foot print but is un-loaded after returning.
 
No not dreaming, just remembering. see here.
 
 
Ben

Message Edited by Ben on 02-12-2007 03:04 PM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 7
(3,728 Views)
I tried the Deallocation and it doesn't seem to do anything for this.
0 Kudos
Message 6 of 7
(3,724 Views)

Hi Just me,

One final thought,

Was the VI un-loaded from memory completely ?

In older version it did what you said (? 6.1 and prior) but now it getting better and LV actually gives back memory, even when the queues aren't destroyed.

If you have  a scenario were you can demo this in a loop, it should suck down memory. I'd like to see this if you have a sample you can share.

Just curious,

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 7
(3,710 Views)