clear event when listener finishes + memory leak

1 回表示 (過去 30 日間)
nick wheeler
nick wheeler 2020 年 2 月 7 日
I have an app written with app designer and it behaves like it has a memory leak and I suspect that I am not handling an event listener call back correctly.
When done with the event should I have an instruction clear event; ? Maybe I have other variable management errors.
The app creates a daq session ('ni') then adds 4 analog inputs which are current mode. The gui includes a button for record - when this is clicked DAQSession.IsContinuous=true; and rate is set to 2048 and a data available listener is set to trigger the call back when 1024 samples have been measured (0.5 seconds)
The ADC is 24 bit but event has two arrays both are doubles one is a one dimensional array of times and the other is 4 by 1024 ADC values it also returns a start time - these are properties of the event.
On this half second event trigger the returned data is managed with some math to sum sequential pairs of measured values (I want 1024 samples per second but the ADC does not support this slow rate) and then scale it to engineering units and then stored in arrays until I have 30 seconds of data at which time it is converted to a table and written out with writetable.
All of the arrays are created (zero filled) with the correct size in the staartupFcn and all are properties of the app as are all scaler variables that are constantly reused.
How should I manage the event object at the end of processing its data? is simply 'clear event;' what I should do or is there a way to write it into a app property so that the memory is assigned?
The app is supposed to run for more than 30 days at a time but it fails in about 3.

回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by