11-12-2020 08:17 AM
Hi all,
I am developing SW that has PC and cRIO 9048 clients.
My SW is almost done, but now I have noticed memory leak which my SW is executing. While SW is idle, no leak is happening, but when it starts executing a test, it looks like my Acquisition or Logging loops are having a memory loop. I narrowed memory leak to operation when my SW is finished pooling DMA FIFO and writes the data to Queue (goes to logging and logs it through TDMS) and Network Stream (goes to PC). When I reduced the number of data pooling, the leak is also happening faster. I thought that it might be queue itself as I am not releasing it at any point, but after changing my SW to release queue after test finishes, memory is not freed.
Sadly I cannot show you the screens of the code due to company policy.
Thank you for any tips,
Matyas Kadlas
11-12-2020 08:45 AM
Tell your company to hire a consultant and sign them to a Non-Disclosure Agreement. If you can find the right expert, you should be able to get a solution with a very short contract. If you put him/her on retainer, you will have access to "secure" help in the future.
Bob Schor
11-12-2020 11:50 AM
@Matzase wrote:
I thought that it might be queue itself as I am not releasing it at any point, but after changing my SW to release queue after test finishes, memory is not freed.
When you call "Release queue" are you using the "Force destroy" option?
Other than that, you either need to show some code or start looking in other places. Looking for arrays that grow as the test progresses, for instance.
11-13-2020 01:32 AM - edited 11-13-2020 01:44 AM
I am not using Force Destroy. I will give it a try. If it does not help, I will try to show you the code. Sadly I won't be able to test it until 22.11. so I will let you know when I get to it.
11-23-2020 08:20 AM
I was finally able to test Force Destroy, but it did not solve anything, I am still encountering the same memory leak during test execution.
I added screenshots of my code where the memory leak might happen as it is happening only when I start the test and memory does not clear when the test ends. When I had higher buffer values, I could see that available memory was reduced around the time when DMA FIFO read the data from FPGA.
Acquisition.png contains main loop of Acquisition. Acquire.png is happening while test is running with Read FPGA Data.png and Read Axis Data.png as subVIs. When test stops Stop Acquisition.png is executed.
Other VI is logging VI. Main loop is in Logging Message Loop (Stop).png. During test Log Data.png is being executed and when test is done, Flush Data to Log File.png is called.
11-26-2020 08:06 AM
I spent some time investigating the memory leak, and I concluded that the TDMS write function causes it. I will try to resolve the issue next week.
11-30-2020 11:08 AM
I didn't see what version of LabVIEW you are using, but there are a few known issues with TDMS in the past that causes a memory leak. One I remember was using the transpose 2D array before a TDMS write.
https://forums.ni.com/t5/LabVIEW/Storing-irregular-sample-data-in-TDMS/m-p/3199795#M927633
If you can isolate the issue please do, since it will help all of us.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
12-01-2020 12:10 AM
Hi Hooovahh,
I am working with LV2017 atm. I am not using any transpose 2D array function, but I am using other array functions (Replace Array Subset, Index Array, ...) before writing. I am in the process of identifying a workaround. I will let you know when I discover if any of those fixes in other threads are working for me.
12-01-2020 08:27 AM
The mentioned functions could be a problem too, just as Transpose 2D array. Adding an Always Copy node before the Write TDMS function is likely to "fix" those problems, at the cost of some performance.