DAQ toolbox memory leak

6 次查看(过去 30 天)
Gary Wolf
Gary Wolf 2016-4-19
评论: Lucie S. 2022-1-10
I've been using without problem the Data Acquisition toolbox with a NI PCIe-6363 acquisition card. I now need to acquire repeatedly large number of points (~1-10e6 from 1 analog input and 2 digital inputs) and this has proved to be a problem with the toolbox. While it does work, every call for acquisition (startForeground function) increases the memory used by Matlab by few Mb (~10% of the data size to acquire), and after a while gets > 10 Gb memory and Matlab stops. Just doing in a for loop startForeground + the memory function shows clearly that each call leaks some memory, and no "clear" can release that memory.
Update 1: It appears the memory leak is only in the presence of digital inputs. If they are replace by analog input, then there is no issue, though this is not a viable solution as the DAQ acquisition rate cannot be as high then.
Any help is appreciated! Thanks.
  3 个评论
Tao Cui
Tao Cui 2017-3-31
I also have this issue with NI in daq session. When digital 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.
Gary Wolf
Gary Wolf 2017-3-31
Sorry, I could not find a solution to this issue (also with R2015b).

请先登录,再进行评论。

回答(2 个)

Tao Cui
Tao Cui 2017-4-25
编辑:Tao Cui 2017-4-25
The root cause to this problem is the handleDataAvailable method in "AsyncIOInputChannel.m" of daq toolbox's NI interface part. It is even clearly labeled by Mathwork developers in the comment on line 134: "!!! Bug, this only handles results from a single task". Not sure if this will be fixed in their future version.
What happened is when there are both digital card and analog card, or when there are both input card and output card running in a session in background mode, there will be two tasks running in asynchronous mode handled by this method. However, this method cannot handle two tasks properly, hence cause memory problem.
Not necessarily an answer, but I hope this info at least can help others or Mathwork developers to patch this bug.

Andrei
Andrei 2017-6-6
编辑:Andrei 2017-12-7
This is fixed in MATLAB R2017b.
A workaround is attached to this bug report .
  1 个评论
Lucie S.
Lucie S. 2022-1-10
I have similar issues with Matlab 2021b (all my drivers up-to-date) and I'm only using one input channel of a cDAQ-9191 + NI 9223 card. Memory keep growing during acquisition, only close matlab release the memory

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Data Acquisition Toolbox Supported Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by