LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory Leak?

Solved!
Go to solution

Hi all

 

I have written and attached a VI that isolates an issue I am having. Every time I try to process a waveform with a large sample size using LabVIEWs "Waveform Measurement" VIs, the program uses up a significant portion of my PCs RAM and it stays used even after the subVI has finished running. Only when I close the main VI does the memory get released again. Am I doing something wrong or misunderstanding the problem or is this actually a memory leak caused by LabVIEW VIs?

 

The example VI simply has a subVI that generates a waveform and processes it with multiple "Waveform Measurement" VIs you can choose from. The subVI closes but the main VI keeps running until the stop button is pressed.

 

 

Any help would be appreciated

 

Aleksandar

Download All
0 Kudos
Message 1 of 4
(1,045 Views)
Solution
Accepted by topic author Loop35

Hi Aleksandar,

 


@Loop35 wrote:

Only when I close the main VI does the memory get released again. Am I doing something wrong or misunderstanding the problem or is this actually a memory leak caused by LabVIEW VIs?


For me (LV2020) the memory gets released when I stop the main VI - I don't need to close it…

 

And yes, that's a misunderstanding from your side about how LabVIEW manages its memory requests.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(1,035 Views)
Solution
Accepted by topic author Loop35

It is not a leak if the memory ultimately gets release, i.e. once you stop the toplevel VI. A leak is if the memory keeps growing forever.

 

LabVIEW does not deallocate the memory of the subVI as long as it is in a reserved state, i.e. the caller is still running. That's a good decision because in more typical use it will get called repeatedly (or at least occasionally). It would be extremely expensive to deallocate the subVI memory whenever the call ends, then allocate about the same amount next time it is called. Over and over! Right?

Message 3 of 4
(999 Views)

I would expect memory to be released when all instances and references left memory.

 

There's the Request Deallocation function that might help. The question is will it help make things better or worse? LabVIEW is pretty good in managing memory. I'd avoid this function unless it's clear why you need them. You don't want to throw them around fixing problems that aren't there.

Message 4 of 4
(951 Views)