LabVIEW Request Deallocation Function Does Not Deallocate Memory

Updated Aug 30, 2023

Reported In

Software

  • LabVIEW

Issue Details

  • I am using the Request Deallocation function in LabVIEW 2017 or newer, but Task Manager shows that memory is not being deallocated even though it was in LabVIEW 2016. Why is this?
  • I need to deallocate memory to save space in my LabVIEW VI or executable. From Task Manager, I can see that memory doesn't get deallocated until LabVIEW is completely closed. How can I get the Request Deallocation function to work?

Solution

In LabVIEW 2017, the memory manager was updated to hold more memory rather than returning it to the operating system. This changed was implemented to improve future allocation speed.

To use the Request Deallocation function, the following considerations must be made:
  1. Request Deallocation only works for subVIs that complete a call but remain reserved.
    • A caller VI that runs once and completes will not indicate any memory deallocation.
  2. Request Deallocation only works on a subVI that uses temporary buffers and whose values are not passed on in some way.
    • For example, a large array in an uninitialized Shift Register is not a temporary buffer. The array must be maintained in memory so that the next call sees the previous value.
    • Values that are passed out of the subVI's Connector Pane are not temporary buffers.
    • Queues and Data Value References take over memory allocation to avoid creating copies. Therefore, these do not create a temporary copy of the data that can be deallocated.
The attached files (saved for LabVIEW 2018) demonstrate how to properly use the Request Deallocation function.