TestStand Memory Usage Increase When Running Loops With Large Iteration Counts

Updated Mar 30, 2023

Reported In


  • TestStand 2016 SP1
  • TestStand 2016
  • TestStand 2014 SP1

Issue Details

Whenever I use loops with large iteration counts in TestStand, the memory usage of TestStand constantly increases and eventually causes the operating system to run out of memory. How do I avoid this?


In general, every time you use a loop within your sequence, you need to be careful about result collection. This is due to the fact that upon each iteration of the loop, a new element is inserted into the Locals.ResultList array variable that will hold the results of that iteration. As Locals.ResultList increases in size, so does the amount of total memory used by TestStand. When dealing with loops that have large iteration counts, this memory usage increase may be significant. There are a couple of situations in which you may experience this behavior: using the Loop Option on a particular step, or using Goto steps to implement a loop. To avoid this problem you may:

  1. Disable result collection for the loop. Depending on the type of looping option you have set up (i.e. step loop options, or using Goto steps to implement a loop) you will need to do one of the following:

  • If you are using the step loop option, you need to disable the Record Results for Each Iteration option. To do this, right-click on the step, and select Properties. Click on the Loop Options tab and uncheck the Record Results for Each Iteration option. Simply disabling the record results under the Run Options tab will not prevent the memory usage increase.

  • If you are using Goto step, While/Do While steps, you need to disable recording of results for each step inside of the loop, including the Goto/While/Do While and the End step. You can accomplish this by right-clicking on each step within the loop (and selecting Properties. Click on the Run Options tab and uncheck the Record Result option.

  1. Generate the report on the fly. In other words, after each step executes, the report is updated and the last element of Locals.ResultList is deleted. You can check select Configure»Result Processing, then click the Options button for Report plugin. In Report Options dialog, enable On-The-Fly Reporting option. You should also select Configure»Model Options and enable option Discard Results or Disable Results when not Required by Model to ensure that results are removed from memory after being added to the report.

Additional Information

Disabling report generation by selecting Configure»Result Processing and deselecting the Enabled checkbox for Report plugin (Configure»Report Options»Disable Report Generation in TestStand 2010 and previous)  will not prevent TestStand from collecting results. Items will still be added to Locals.ResultList even though no report is generated.