Deallocating Memory in LabVIEW

Updated Sep 15, 2023

Environment

Software

  • LabVIEW

I have subVIs that initialize very large arrays and I would like to deinitialize them or somehow free up the used memory once the subVI has executed. Is there a way to do this?

LabVIEW 7.0 has introduced a function that will deallocate memory once a subVI has finished executing. The Request Deallocation Function can be found in the Functions Palette by going to Advanced » Data Manipulation.  In recent versions of LabVIEW this function can be found on  Application Control» Memory Control.

To use the Request Deallocation Function is suggested to call subVIs dynamically using one of the following approaches: call and forget and call and collect. Once the subVI has finished the execution you can call the Request Deallocation Function.

Additional Information

Further details about call and forget and call and collect are available in the documentation of the Open VI Reference Function.

If your subVIs includes large sets of data follow the indications provided in Memory Management for Large Data Sets. Avoid using shift registers inside of subVIs when using the Request Deallocation Function, since the deallocation could not be completed because LabVIEW maintains the latest value of the shift register in memory.