NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to end an execution programmatically?

Solved!
Go to solution

Hi,

 

I have a top level sequence which calls bunch of sequences in a new execution one after other (i have selected Before executing next step for wait for execution to complete). I noticed that when an execution finishes, it does not release all the memory it acquired (i am observing this using performance monitor). This causes a big memory leak and eventually Teststand crashes when it occupies 1300MB of RAM. How can i force teststand to end an execution before i start another execution. I will try to post an example as soon as i can. Thanks in advance.

0 Kudos
Message 1 of 8
(5,671 Views)

The execution is properly finished and i am sure that there is no memory leak.

Are you using external code modules (DLL, .NET assemblies, LV VIs, ...)?

I assume, yes. So the explanation is right there: Unload options for your code modules!

 

If the unload options are set to default (unload when sequence file is unloaded), you have to unload the sequence file in order to free the memory used by the code modules. So either do this, or change the unload options for the code modules to e.g. "unload after sequence executes" (setable in the run options for the steps or in the sequence file properties).

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 8
(5,670 Views)

Hi NorbertB,

 

Thanks for your reply(That was very quick). I am attaching an example of what i am trying to do. Yes i do use code modules (Dll's) and i am aware of my load and unload options. I tried your suggestion, but no luck. Please run the sequence and observe the memory. Everytime i call the sequence which generates the data, the memory keeps going up. What i want is, when i call a new execution, i want all the previous execution data to be purged (All the memory allocated should be released). For every execution, a report is generated, so i will be getting 1 report for every sequence call. Once the report has been generated, i do not need any data from that execution. Thanks

0 Kudos
Message 3 of 8
(5,666 Views)

Your execution has ended because of your "before executing next step setting", what is likely the problem is that the results for the execution get attached to your sequence call step and do not get freed until they are done being processed by report generation and database logging in the process model at the end of the UUT (if you are using a process model similar to the ones that ship with TestStand). If you don't want the results then you should be disabling result collection either globally (there is a station option for this) if you aren't using our models and don't want result collection at all, or for the sequence you are calling in a new execution (there is a setting in the sequence properties dialog to disable results on a per sequence basis), or yet another alternative is to allow the results for the execution to be collected, but to set your sequence call step to not record results (it;s one of the checkboxes in the Run Options section of step settings). They will then be thrown away after the sequence call step is done executing.

 

Hope this helps,

-Doug

0 Kudos
Message 4 of 8
(5,642 Views)

Hi Doug,

Thanks for your reply. I am using the same process model that shipped with Teststand. I am calling new executions using "Single Pass Entry Point".I do not have "On the Fly Reporting" nor Database logging enabled. So when an executions ends, it must have done with generating report, as the TestReport callback comes well before the cleanup steps in the Processmodel .  Like you say, may be the execution ends but it does not release the memory allocated for "ResultList" container. Is there any way to force Teststand to release the memory allocated for "ResultList" container. I am comfortable in making changes to Processmodel if i need to. BTW, i definitely want the results, so disabling result collection is not an option for me. Thanks

0 Kudos
Message 5 of 8
(5,609 Views)

Even though your new execution uses a process model, when you do Single Pass, TestStand still saves the results and attaches them to your sequence call's results when you use the Wait Before Executing Next step option. If you don't want the results then simply uncheck the record results setting on your sequence call.

 

Hope this helps,

-Doug

0 Kudos
Message 6 of 8
(5,598 Views)

Doug,

 

As you said, i unchecked the record results on my sequence call setting. But there is no improvement. The memory still keeps growing. Please use the example i posted earlier to reproduce on your end. The only way i could get away from this memory issues is by selecting "On the Fly Reporting", "Conserve memory and Display latest Results" under report options and selecting "Discard Results or Diable results When not required by the model" under the model options.

 

But really i do not want On the Fly reporting. Is there any way i can instruct Teststand to discard results. I think "Discard results" option works only if you have On the Fly Reporting enabled.

0 Kudos
Message 7 of 8
(5,581 Views)
Solution
Accepted by topic author Nathan Vaidyanathan

You need to do a couple of additional things in order to get rid of the results after each execution. Here's a list to make sure you get them all:

 

1) Move your new execution sequence call into its own subsequence - this is necessary because a reference to the new execution is stored as a hidden local variable in whatever sequence the sequence call is in and you want the execution to go away so you need to return from the sequence that made the call to make sure that this happens.

 

2) You need to check the "Close Window When Done" setting on the advanced sequence call panel for the new execution sequence call - again, you want the execution to go away after it is done so you must make sure you aren't keeping it open anywhere.

 

3) make sure you uncheck the step setting Record Results on the new execution sequence call - if you don't do this then all of the results for the execution will be attached to the sequence call and you will still be using a lot of memory even if the execution goes away.

 

Hope this helps,

-Doug

Message 8 of 8
(5,564 Views)