02-11-2021 09:30 AM - edited 02-11-2021 09:34 AM
Hey guys,
I have an issue with the refnum to an TDMS file. I've written a VI which generates a TDMS file, if it is not existing yet and is storing some data inside. Since this VI will be continuously recalled, I dont want to close the TDMS file, but pass the reference to the next call of the VI. To do so, I pass the reference to a feedback node.
When I first run the VI, the left refnum compare returns true and the right one false as expected (cf. probe watch).
However, if I run the VI again the feedback node seems to return the correct refnum (compare probe watch) but both the not a refnum compare functions return true! This behaviour is confusing me.
Maybe there is some misconception on my side. Can someone explain to me, whats going wrong here?
Thanks & Cheers,
Jens
PS: find the MWE attached
PPS: Edited due some text loss when posting
Solved! Go to Solution.
02-11-2021 12:37 PM - edited 02-11-2021 12:40 PM
Hi Polz,
when the VI stops execution LabVIEW will automatically close all references for you.
So even when the feedback node gives a reference in the next run that reference is not valid anymore!
You can prevent the automatic reference cleanup (kind of garbage collection) when your VI is called in a context where the execution is not stopped, like when you call the VI as subVI in a loop of your mainVI…
02-11-2021 01:45 PM
Hey GerdW,
I am embaressed. Could have thought of that one myself...
The VI is going to be a subVI anyways, so no trouble at all. Just wanted to test it before deploying it to the main program. Thanks for the eye opener.
Cheers,
Jens