Memory Leak When Executing Single Pass Entry Point Multiple Times

Updated Jul 13, 2023

Reported In

Software

  • LabVIEW
  • TestStand

Issue Details

I customized the LabVIEW Simple User Interface in order to add a standard boolean button which should trigger execution of SinglePass entry point of SequentialModel.seq process model. In order to achieve this:
  1. I called GetCommand method with cmdKind input set to CommandKind_ExecutionEntryPoints_Set and Index set to 1 (which corresponds to SinglePass entry point)
  2. I called Execute method for Command class
as shown below:
 

However, if I click on the boolean button multiple times in order to execute SinglePass again after the end of the execution and I repeat this operation multiple times, in Windows Task Manager I notice a small, but constant memory leak (about 10 MB increase in 1 minute).
I also notice a small memory increase if I launch execution using standard ActiveX button for SinglePass entry point. There is no memory increase if I use standard ActiveX TestUUTs button.

What is causing this problem?
 

Solution

The memory growth in the customized user interface is caused by never closing the execution, so after running SinglePass entry point continuously for a while, you have hundreds of executions that are still open. The same problem can occur when using C# GUI, or any other interface.

You should modify your custom user interface in order to programmatically close the execution when it finishes running, as displayed below:
  1. call GetCommand method with cmdKind input set to CommandKind_Close to get a reference to the command used to close execution
  2. call GetCommand method with cmdKind input set to CommandKind_ExecutionEntryPoints_Set to get a reference to the command used to launch execution of SinglePass entry point
  3. call Execute method for Command class to execute the CommandKind_ExecutionEntryPoints_Set command
  4. call Execute method for Command class to execute the CommandKind_Close command

 

Additional Information

You can experience the same memory growth also using the standard ActiveX SinglePass button on the standard LabVIEW Simple User Interface if you press it again to launch a new execution after the end. Also in this case, you will have multiple executions opened, as you can observe in the Execution Combobox:
 

You can close each execution by pressing Close Execution button on the user interface (which is connected to command CommandKind_Close.