07-08-2021 12:24 AM - edited 07-08-2021 12:29 AM
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
Solved! Go to Solution.
07-08-2021 12:35 AM - edited 07-08-2021 12:37 AM
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.
07-08-2021 01:23 AM
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?
07-08-2021 07:34 AM
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.