The allocation of Local Variables occurs when the calling VI is loaded into memory. If it is a stand-alone VI, then the memory for the Local Variable is allocated at run-time and deallocated at the end of its run. If the Local Variable is declared in a subVI statically loaded in a main VI, then the memory for the Local Variable is allocated when the main VI is loaded into memory and deallocated by the LabVIEW memory manager shortly after the main VI is unloaded. If the subVI is loaded dynamically, as in the image below, then the memory for the Local Variable is allocated at the call of the subVI and deallocated by the LabVIEW memory manager shortly after the subVI is unloaded.
Global variables exist in special Global VIs, separate from the flow of the application. When accessed by another VI, they bring a copy of the variable into memory. This copy is destroyed when the calling VI is unloaded from memory. Note that copying large arrays or other large variables can be intensive and time consuming.Deallocate Memory
There is no way in LabVIEW to programmatically deallocate the memory set aside for global and local variables, but you can deallocate the memory set aside for running a subVI before the top level VI has completed. Implement the Request Deallocation VI after the subVI has completed its operation to clear the subVI's memory.
Thank you for your feedback.
You changed your response to Not Helpful
You changed your response to Helpful
Collaborate with other users in our discussion forums
A valid service agreement may be required, and support options vary by country.