04-27-2022 10:12 AM
Hi all,
I am currently using:
LV 2021 SP1
cRIO 9035
NI Linux RT 2021 5.10.83-rt58
My question is generally directed to how LV handles memory allocation for channel wires when buffering data and how that is affected when you set a channel writer size.
In my program, I have various channel writers and readers that queue data written by a producer loop and buffer when the consumer loop enters a pause condition (the length of this pause can be variable depending on the processes we have running in the background). I have been tracking the memory usage of LV by querying through a SystemExec command (cat /proc/$(pidof lvrt)/status | grep RSS) along with the counts in the channel given by the channel writer. Attached are the channel counts (left) and memory (right) over time.
It can be seen that even with a limit on the counts in the channel wire, memory usage grows. I was under the impression that a limit on the channel count would mitigate growth of memory and prevent slow memory leaks from occuring. However, we are still seeing this growth. Is there something I am missing on how channel wires allocate memory? Should I be implementing a closing of the wire when it reaches the maximum count?
I am new to LV, so any pointers would be appreciated.
05-11-2022 11:47 PM
Would you rather LabVIEW allocate all the possible memory (for max channel size) on the first run? That could be a really cool feature for RT applications. Or... would you expect LabVIEW to allocate more memory as needed when the channel count hits the maximum? I think we are seeing the latter, and I don't think that qualifies as a leak. Have you run the test for longer to see if the memory grows beyond the apparent asymptote?
05-16-2022 02:01 PM
Hi Doug,
Thanks for the reply. I think allocating for max channel size would be ideal; makes memory management much more predictable. Ran some tests for longer and memory consumption eventually does level out, but would be nice to have that allocated at the beginning of the run (and throw an error of possible memory consumption > memory available).
05-17-2022 05:34 AM
Sounds to me like on RT, channels could (should) use RT Queues...
For now, the channel functionality is not that hard to DIY.