10-27-2016 10:22 AM
Thanks for the reply...
Does this include Queue references? I am currently not using any VI or data references, just Q's.
10-27-2016 10:28 AM
@BG103 wrote:Thanks for the reply...
Does this include Queue references? I am currently not using any VI or data references, just Q's.
Yes!!! Queues, File, Notifiers, etc. etc. etc.
Here is a good article for you to read through: Closing References in LabVIEW
10-27-2016 10:36 AM
@BG103 wrote:Does this include Queue references? I am currently not using any VI or data references, just Q's.
Absolutely. Every Obtain Queue should have a matching Release Queue. Every instance of Obtain Queue creates a new reference that needs to be closed, even if you're obtaining references to named queues that have already been created.
Two general rules:
1) Pass queue references into loops. Don't obtain queues (or other resources) repeatedly inside loops.
2) Avoid named queues unless you really need them. Use wires to pass queue references.
10-27-2016 10:41 AM
Thanks for the advice and information.
You said pass Q refs via wire...Is it possible to pass Queue references via a funcitonal global variable?
10-27-2016 10:50 AM
@buton wrote:
Wait, what?
Is the "This VI" constant (I'm assuming the constant is autoconverted to a control in a snippet?) enumerated to a new VI reference each time it enters a property node or invoke node? this is news to me, I assumed it always pointed to the same reference.
10-27-2016 11:13 AM
@BG103 wrote:You said pass Q refs via wire...Is it possible to pass Queue references via a funcitonal global variable?
Yes, that's OK too. A common pattern is a functional global that creates the queue the first time it's called, and then returns the same queue reference from the shift register on every call after that. The idea is to avoid opening multiple references to the same named queue, because that's where it's easy to leak a reference.
10-27-2016 12:42 PM
So will reference leaks cause "Out of Memory" or "Memory is Full Error"?
Also, anyone know what the Reference Leak >> File : 0x82E0024A is caused by? I would assume they are file references but I the source VI does not have any file reference handles.
10-27-2016 12:54 PM
@BG103 wrote:So will reference leaks cause "Out of Memory" or "Memory is Full Error"?
In my experience, not likely. The Out Of Memory is typically caused by growing arrays. But reference leaks can also cause it or at least major slow-downs or an error while trying to create another reference (yes, I have seen this error caused by creating 2^32 references).