DAQ toolbox memory leak

6 Ansichten (letzte 30 Tage)
Gary Wolf
Gary Wolf am 19 Apr. 2016
Kommentiert: Lucie S. am 10 Jan. 2022
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 Kommentare
Tao Cui
Tao Cui am 31 Mär. 2017
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 am 31 Mär. 2017
Sorry, I could not find a solution to this issue (also with R2015b).

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Tao Cui
Tao Cui am 25 Apr. 2017
Bearbeitet: Tao Cui am 25 Apr. 2017
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 am 6 Jun. 2017
Bearbeitet: Andrei am 7 Dez. 2017
This is fixed in MATLAB R2017b.
A workaround is attached to this bug report .
  1 Kommentar
Lucie S.
Lucie S. am 10 Jan. 2022
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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Acquisition Toolbox Supported Hardware finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by