Memory Issue with DAQ

11 views (last 30 days)
Josh
Josh on 29 Jun 2012
Answered: Tao Cui on 25 Apr 2017
We are having a memory problem with the Data Acquisition toolbox in Matlab. We are using a National Instruments card, NI PCIe-6363, with NI-DAQmx drivers 9.5.0. The problem is memory build up. Using the Windows Task Manger, it can be seen that Matlab idles around 300 MB but during acquisition, that number increases and can get as high as 2-3 GB. The severity of this problem increases as more channels are utilized. Below is a sample of the code that can be used to induce this memory overflow. I think this was also a similar problem here: http://www.mathworks.fr/matlabcentral/answers/37350-possible-memory-leak-in-data-acquisiton-toolbox-using-ni-daq-6229-bnc-in-continuous-output-mode
Also, the spec of the computer I'm using are: Windows 7, 64 bit, 4 gigs of ram. Matlab R2012a.
s = daq.createSession('ni');
s.addAnalogOutputChannel('Dev1',0,'Voltage');
s.addAnalogOutputChannel('Dev1',1,'Voltage');
s.addAnalogOutputChannel('Dev1',2,'Voltage');
s.IsContinuous = true;
s.Rate = 400000;
data = repmat(linspace(-1, 1, 400000)',1,3);
lh = s.addlistener('DataRequired', ...
@(src,event) src.queueOutputData(data));
s.queueOutputData(data)
s.startBackground();
pause();
s.stop();
delete(lh);
delete(s);
  5 Comments
Tao Cui
Tao Cui on 31 Mar 2017
I also have this issue with NI in daq session. When both digital and analog channels are presented in the session and when the task is started in background, memory keeps growing and eventually Matlab crashes with out of memory error. If there are only analog channels, everything will be fine.
The version I have is R2015b. It has been a while since this post, could you let me know if you found a solution.
Walter Roberson
Walter Roberson on 31 Mar 2017
Tao Cui: please note that previous participants do not receive email notification when Comments are added, so Josh and Andrea might not notice your request.

Sign in to comment.

Answers (1)

Tao Cui
Tao Cui on 25 Apr 2017
It seems this is really an old bug in Matlab DAQ toolbox. When there are two tasks (input and output, or digital and analog) running in background, this bug cause memory to blow up.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!