LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Network Stream memory leak with cluster of arrays

Solved!
Go to solution

I'm using Network Streams in an sbRIO application, and I'm seeing a memory leak while the RT endpoint is connected to the Windows endpoint. This happens with string endpoints and cluster-of-arrays endpoints. I've attached an example that exhibits the behavior.

 

I found this KB, which seems to explain the problem, but the solution it offers is just to switch to scalar types: http://digital.ni.com/public.nsf/allkb/784CB8093AE30551862579AB0050C429

 

I can't do that in my application; I need to package scalar data with a block of multi-channel samples and send it all together (as seen in the typedef I included with the attached example). How can I manage this without creating a memory leak that will eventually cripple my application?

0 Kudos
Message 1 of 8
(6,441 Views)
Solution
Accepted by topic author David_Staab

Never mind. Setting the buffer size to a smaller value got the "leak" to stop. I had it set so large that the buffer was still allocating itself the entire time I was monitoring the application. When I changed it to 50 elements, it only spent a few seconds allocating, then the "leak" stopped.

Message 2 of 8
(6,440 Views)

Thanks for updating this.  you just saved me a few hours debugging

0 Kudos
Message 3 of 8
(6,280 Views)

Hi David,

 

Thank you for posting your resolution a few years ago.  It also saved me hours (or possibly days) of debugging. I had found this knowledge base article (http://digital.ni.com/public.nsf/allkb/784CB8093AE30551862579AB0050C429) but I had not realized until reading your post that one of my streams includes an array of DBL and if LV keeps dynamically allocating memory instead of replacing old values, I was potentially asking my CompactRIO target for 800MB of RAM.  Reducing the size of the buffer from 100000 to 1000 seems to have fixed my problem.

 

Olivier

Message 4 of 8
(6,125 Views)

Really big thanks for posting the solution - I was tracking a huge memory leak for two days, and finaly found it's in Network Streams. Your post saved me a lot of time to find how to resolve the issue!

0 Kudos
Message 5 of 8
(5,837 Views)

I came across this post today after spending an entire day trying to figure out why my RAM kept increasing when using network streams to send waveform data back to my host. Thank you for posting the solution! 

0 Kudos
Message 6 of 8
(5,818 Views)

12 years later, this post is still very useful - it solved the huge memory leak I had in my application.

 

Thanks for posting the solution.

0 Kudos
Message 8 of 8
(775 Views)