Deallocating Memory in LabVIEW

Updated Apr 29, 2020

Reported In

Software

  • LabVIEW

Issue Details

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?

Solution

LabVIEW 7.0 has introduced a fuction 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 more recent version of LabVIEW this function can be found on  Application Control» Memory Control.

To use the Request Deallocation Function is suggested to call subVIs dinamically 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 shit 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.