NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to release reference after aborting an execution

Hi,

I have a sequence file calling Engine.SequenceFileEx to get reference to a sequence file object, and in <Cleanup> calling Engine.ReleaseSequenceFileEx method to release the reference. It works when execution finished or terminated.

But the reference does not get released if i abort the execution, before the
Engine.ReleaseSequenceFileEx method is called. An error is thrown, when i run it again.

Can anyone help me out? How can i guarantee the release to a reference?

Thanks

Regards
MY
0 Kudos
Message 1 of 8
(4,730 Views)

Abort means "stop executing as soon as possible and don't cleanup". A consequence of not "cleaning up" is that you can leave your system in an undesired state. Thus, abort is not always a good choice to have. You can edit your user privileges to remove the privilege to abort.

Note that is it possible to cleanup by creating a COM object that you hold the only reference to in a local variable. When the sequence completes, either normally, or with an abort, all local variables are released and the COM object will destruct. You can place your cleanup code in the COM object destructor. However, if you aren't familiar with creating COM objects, this might be more trouble than it is worth.

0 Kudos
Message 2 of 8
(4,723 Views)
Hi James, thanks for your solution! I have edited the user privileges.
Regards
MY
0 Kudos
Message 3 of 8
(4,696 Views)
I have a similar situation, but in my case I am not 'aborting' but closing the test executive with the close button (X in upper right hand corner).

What is not released is every 'Cleanup' that is part of a sub-sequence call where I call some code to perform after test actions such as data logging for that test step.

These (like everything else in my sequence) are set to be loaded when execution begins and unloaded when the sequence closes, but they appear to stay loaded.

And unless I turn off the Debug warning under station options, the warning is there pretty much every time.  Except if I load the sequence but don't actually ever execute the sequence.
This seems consistent with the don't load until execution part of the operation, but the unload doesn't seem to happen before the sequence closes.

Thanks
0 Kudos
Message 4 of 8
(4,686 Views)

Hi,

Are you using the default OI or SeqEditor or a Customised OI?

And which version of TestStand?

Regards

Ray

Regards
Ray Farmer
0 Kudos
Message 5 of 8
(4,649 Views)
Ray,

I am using the standard LabWindows/CVI version of Test Executive from Test Stand 4.01.

From the Sequence Editor, I do not see this problem, or at least I don't recall having seen it, only from Test Executive.

I've been reading several threads on the subject and some talk about GetSequenceFileEx and ReleaseSequenceFileEx, neither of which exist in my code.

Thanks,
Mark
0 Kudos
Message 6 of 8
(4,632 Views)

Hello Mark,

Were you able to find a solution to your problem?  It has been a while since you posted to I wanted to check on the status of your program.  If you are still having trouble then maybe you could provide some updated information or even your sequence file, if you deem necessary, and we can take a look.

John B.
Applications Engineer
National Instruments
0 Kudos
Message 7 of 8
(4,534 Views)
John,

Yes, I finally found out what it was.  In one place, one string was not being released after it was used.  Since this is a function that gets called by every test step in the cleanup part of the sub-sequence call, it created a lot of warnings that warned of test steps not being unloaded, not a string not being freed.

That mis-led me initially.

 I eventually read something somewhere on the forum that implied steps aren't unloaded if there are any resources still allocated so I looked for something like this but didn't see it initially.

I think what happened, is that I was following the examples I'd seen and releasing the string immediately after each use.

In this case I was using the same string many times and releasing it before the next use.  Somewhere in the process I got bit by the "cut 'n paste" bug and missed one of the calls to free memory.

Thanks,

Mark
0 Kudos
Message 8 of 8
(4,531 Views)