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

Walter Roberson
Walter Roberson 2012년 6월 29일
Which MATLAB version are you using?
Josh
Josh 2012년 6월 29일
Matlab R2012a. Edited my previous post to include that.
Andrea
Andrea 2013년 12월 10일
We are actually facing the same problem. We have Matlab R2013b (64bit) running on Windows 7 and we use two NI PCIe-6259 and one PCI-6723 Card. While having 42 analog and digital output channels activated we fill the 8Gb Ram of our lab computer within 5 minutes. (We use basically the same script as posted above, but also tested other configurations (e.g. with startForeground)).
After clearing the whole workspace with 'clear all' the Ram is still completely occupied and only after shutting down Matlab it is free again.
We tried to use the Matlab Profiler, but we are unsure of how to interpret the different memory parameters that are shown (e.g. what is the so called 'self memory' tab refering to).
Any help would be really much appreciated.
Tao Cui
Tao Cui 2017년 3월 31일
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 2017년 3월 31일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Tao Cui
Tao Cui 2017년 4월 25일

0 개 추천

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.

질문:

2012년 6월 29일

답변:

2017년 4월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by