"PropertyObjects Were Not Released" Warning When Shutting Down My TestStand UI

Updated Apr 30, 2024

Reported In

Software

  • TestStand
  • LabVIEW

Operating System

  • Windows

Issue Details

When I shut down my TestStand UI, I receive a warning that PropertyObjects were not released:
I am doing one of the following:
  • Using a LabVIEW User Interface (UI)
  • Running a TestStand sequence that contains LabVIEW code which converts an ActiveX variant wire to a property object.

Solution

  1. Check for unclosed references within your LabVIEW code. See Closing References in LabVIEW  for more detail
  2. If you have closed all of your open references, are using LabVIEW 2013 or earlier, and have variant wires in your LabVIEW code that holds a reference to PropertyObjects, you will need to move the conversion between a variant and an ActiveX reference to inside of a dynamically called VI.
    • There are two zip files attached which contain VIs you can use for this purpose.
      • If you are using LabVIEW 7.1.1, please download Dynamic Variant to Data 7.1.1.zip.
      • If you are using LabVIEW 8.0 or later, please download Dynamic Variant to Data 8.0.zip.
      • Each zip file includes the necessary VIs, an example sequence, and an example VI that shows how to use the dynamic VIs. 
      • When you use the attached SubVI, you will need to use it in addition to the Variant to Data VI that is already converting the variant. Also, be sure to close the reference that it creates as shown below in Figure 1.

Additional Information

The most common cause of PropertyObject leaks is an unclosed reference.
Thus, this warning is likely happening because the TestStand engine is shutting down before LabVIEW has released all property object references. It is good LabVIEW practice to close all references opened within LabVIEW by using the Close Reference VI.

Variant wires can also hold references to PropertyObjects. However, variants cannot be closed explicitly, and will not be freed until the VI leaves memory. Please note that this issue has been fixed in LabVIEW 2014, and the following code change is not necessarily in LabVIEW 2014 or later.  
By moving the conversion between a variant and an ActiveX reference to inside of a dynamically called VI, the variant data will be freed since the VI will be removed from memory upon completion of execution.

Background:
ActiveX references work by keeping a reference count of the number of users of the reference. This reference count is initialized to one when the reference is created. Every copy of this reference increments the reference count. To properly free the reference, programs must decrement the reference count. When the reference count reaches zero, the system automatically frees the reference. 

In LabVIEW, the reference count is incremented whenever a new wire is created, and calling the Close Reference VI decrements the reference count. However, if the new wire is a Variant wire, we cannot close the reference explicitly. In this case, the only way to free the memory and decrement the reference count is to have the VI containing the variant leave memory. 

Especially when using UIMessages which are handled by reentrant callback VIs, the best way to ensure that the VI is unloaded from memory is to use a dynamically called VI.  The VIs and examples attached show proper usage to prevent PropertyObject leaks.