12-17-2010 11:57 AM
Could you verify your version of NI-DAQmx as well? You can do this by opening MAX, expanding the Software section, and looking for NI-DAQmx Device Driver.
12-18-2010 11:54 AM
Hi estiers,
Thanks for posting your code. I didn't run it, but I noticed that it uses a mixture of DAQmx and DAQmx Base VIs. I think the problem is that "Collect Data.vi" uses "DAQmxBase Clear Task.vi" with a DAQmx task. Clearing an invalid DAQmx task does not generate an error, and I assume that DAQmx Base matches this behavior, so this VI leaks the tasks and all of their resources (including system threads).
Why doesn't "Collect Data.vi" leak when you run it in isolation? By default, DAQmx tells LabVIEW to automatically clean up tasks when the top-level VI stops executing. Only when you keep the top-level VI running for a long time (like with "This one makes threads.vi") will you actually see the effects of a VI that leaks DAQmx tasks. Note that you can disable auto-cleanup for a specific task using "DAQmx Create Task.vi":
Anyway, please try replacing the DAQmx Base VIs with DAQmx VIs and see if that solves the problem.
Brad
12-20-2010 04:14 PM
>Seth B.: Could you verify your version of NI-DAQmx as well? You can do this by opening MAX, expanding the Software section, and looking for NI-DAQmx Device Driver.
I didn't find an entry exactly matching the term "NI-DAQmx Device Driver", here's what I did find:
NI-DAQmx 8.7.2
NI-DAQmx Base 3.2
>Brad K: Anyway, please try replacing the DAQmx Base VIs with DAQmx VIs and see if that solves the problem.
Thanks for the suggestion, I removed "Base Clear Task.vi" from both channels, and I didn't see any other DAQmx Base VIs. The extra threads still appear when "Collect Data.vi" is run as a sub-VI. I think the explanation of why extra threads appear only when run as a sub-VI makes sense, but it looks like the leak still exists.
I'll be out for about a week for Christmas break, but I'll keep working on this problem after I get back on the 28th. Thanks again for all the help.
12-20-2010 04:33 PM
Hi estiers,
Did you remove the DAQmx Base Clear Task VIs entirely, or did you replace them with DAQmx Clear Task VIs?
Brad
12-20-2010 04:50 PM
I removed them entirely, and in re-reading your first post I now see that I should have replaced them with the non-Base version. I'll try that next time I get on the system.
Thanks!
01-04-2011 09:59 AM
I removed the DAQmx Base Clear Task VIs and replaced them with the DAQmx Clear Task VIs. The system can run for extended periods now without producing extra threads. It looks like the problem was caused by mixing the two types of VIs.
Thanks again to all that helped!