Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with memory leak using DAQmx & VB6

I'm using DAQmx 8 with VB6 to control an NI 6251 analog input board. The application calls for changing channel configurations as the system is running, thus there are many multiple create task/clear task calls. I've been trying to track a memory leak, so I've created a very simple VB app to help identify the source. I have a loop with the following calls in it:
 
DAQmxCreateTask
DAQmxAddGlobalChansToTask
DAQmxCfgSampClkTiming
DAQmxStartTask
DAQmxReadAnalogF64
DAQmxClearTask
 
I see a little over 1Kb leak per loop iteration. If I skip everything except the create task, add channels and clear task, it still shows a leak.
 
Am I doing something wrong? Should I not be calling CreateTask/ClearTask multiple times?
 
Thanks for any help.
mfrazer
0 Kudos
Message 1 of 2
(6,863 Views)

Mfrazer,

You definitely don’t want to have CreateTask and subsequently ClearTask in a loop, nor does it look like you need to for your application. You only need on task, you just need to change the task, so there is no need to create multiple tasks. So leave the CreateTask and ClearTask on the outsides of your loop, and keep everything else on the inside of the loop and make the changes you need to the task each iteration. Also you are going to want to have a DAQmxStopTask after your read to make sure the task is stopped and in the proper state to be reconfigured. I hope that helps.

-GDE

0 Kudos
Message 2 of 2
(6,854 Views)