LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Channel wire memory allocation when size is set?

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. 

 

LV Mem v Count.png

 

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.

0 Kudos
Message 1 of 4
(795 Views)

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? 

Doug
NI Sound and Vibration
0 Kudos
Message 2 of 4
(740 Views)

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).

0 Kudos
Message 3 of 4
(716 Views)

Sounds to me like on RT, channels could (should) use RT Queues... 

 

For now, the channel functionality is not that hard to DIY.

0 Kudos
Message 4 of 4
(696 Views)