LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Nidaqmx controls cause resource leak

Solved!
Go to solution

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)

S. Eren BALCI
IMESTEK
0 Kudos
Message 1 of 5
(3,448 Views)

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. 

Regards,

Ali S.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 5
(3,416 Views)

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.

S. Eren BALCI
IMESTEK
0 Kudos
Message 3 of 5
(3,404 Views)
Solution
Accepted by topic author ebalci

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);

 

 

 

Carlo A.
Megaris




Message 4 of 5
(3,397 Views)

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..

S. Eren BALCI
IMESTEK
0 Kudos
Message 5 of 5
(3,395 Views)