07-05-2012 07:23 PM
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?
Solved! Go to Solution.
07-05-2012 07:28 PM
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.
10-07-2013 06:02 AM
Thanks for updating this. you just saved me a few hours debugging
09-16-2015 05:01 PM
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
04-25-2017 07:14 AM
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!
04-25-2017 07:29 PM
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!
04-25-2017 08:24 PM
01-19-2024 10:17 AM
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.