10-06-2016 01:03 AM
Hi,
I have some string controls on my UIR, which I convert to daqmx device and channel selection controls using the functions like NIDAQmx_NewPhysChanAICtrl, NIDAQmx_NewDeviceCtrl, etc. So far so good..
Upon exiting my execution (which I started from the cvi ide) the resource tracker warns me about 8 different thread lock objects remaining in memory, and all point to those daqmx control functions (which are called exactly 8 times). Photo attached 🙂
Is NI aware of such a leak? Is it solved in later versions of CVI?
I am running win7-64 bits, CVI 2012 sp1, Daqmx 15.0.0f2 (as seen from MAX)
Solved! Go to Solution.
10-06-2016 04:49 PM
S. Eren,
This is Ali from National Instrument's applications engineering. I did some research on recorded issues and I don't think anything is recorded for this memory leak.
Would you happen to have a smaller version of your code that showcases the same leak? This is something I can definitely look into and see if I can recreate (if so I can document) on my end.
10-07-2016 06:26 AM
Hi Ali,
It is easy to reproduce. I have 8 string controls on the panel. 2 of them are converted with NIDAQmx_NewDeviceCtrl, 2 are converted with NIDAQmx_NewPhysChanCICtrl and 4 are converted with NIDAQmx_NewPhysChanAICtrl.
(These functions are in the daqmxioctrl.fp instrument)
Attached is a small project with 1 device and 1 channel control. Upon exit you can see the remaining open resources in the Resource Tracking window.
10-07-2016 11:03 AM
It seems you forget to discard controls (as all NI samples do).
Simply add these two lines before DiscardPanel(panelHandle);
NIDAQmx_DiscardIOCtrl (panelHandle, PANEL_STRING_DEVICE);
NIDAQmx_DiscardIOCtrl (panelHandle, PANEL_STRING_CHAN);
10-07-2016 11:27 AM
Wow, I really do not know how I missed that..!
I am using CVI for a long time and first thing I did when I was warned by the resource tracker was to look for such a discard function. But I have no idea why I could not find it.
I was so convinced (and surprised) that those functions did not exist.
Anyway, thank you for looking into the matter.
Cheers..