LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RT memory leak

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

 

0 Kudos
Message 1 of 9
(1,551 Views)

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

0 Kudos
Message 2 of 9
(1,543 Views)

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

0 Kudos
Message 3 of 9
(1,512 Views)

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.

0 Kudos
Message 4 of 9
(1,484 Views)

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.

0 Kudos
Message 5 of 9
(1,441 Views)

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.

0 Kudos
Message 6 of 9
(1,412 Views)

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.

0 Kudos
Message 7 of 9
(1,382 Views)

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.

0 Kudos
Message 8 of 9
(1,368 Views)

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.

Rolf Kalbermatter
My Blog
Message 9 of 9
(1,359 Views)