NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Engine.ReleaseSequenceFileEx():Modified sequence file handle is not released

Solved!
Go to solution

Hi,

Greetings All

 

I'm facing a problem of memory leak basically,TestStand engine cache is not cleared. I have a master sequence file which calls a .NET dll. The dll has functions to delete steps in sequence "DestinationSequence" in "TXTModify.seq" and insert new step in same sequence after that.The operation is performed flawlessly and i can see that my "TXT modify.seq" file is modified.

 

After the operations are performed I'm releasing the handle to sequence file "TXTModify.seq" by call of Engine.ReleaseSequenceFileEx() on modified sequence file.But as soon as i close my TestStand sequence editor I'm getting Debug warning(Screenshot of debug warning is attached).This waring should not have appeared as i have already cleared my sequence file handle from TS engine cache by call of  Engine.ReleaseSequenceFileEx().

 

Please help me in getting rid of this warning.Your generous help or suggestion will be appreciated.

 

Thanks in advance.

 

Regards

VDC

 

PS: C#.NET source project as well all the sequence file needed are attached.You may need to keep the sequence file at specific location(Build the folder structure)

 

TXTModify.seq location: d:\Core_ATE_application\Test_Executive_domain(TED)\Source_Code\MemoryLeak_SupportFiles\TXTModify.seq

 

HTMLModify.seq location: d:\Core_ATE_application\Test_Executive_domain(TED)\Source_Code\MemoryLeak_SupportFiles\HTMLModify.seq 

Download All
0 Kudos
Message 1 of 6
(4,515 Views)

VDC,

 

i think that MemoryLeak_Report.cs contains all major source code for your application. In this code, the only call to ReleaseSequencFileEx is in your btn_Click methods. Just before this release, you create a new reference to the sequencefile by calling GetSequenceFileEx. So the GetSequenceFileEx in your InsertStep and DeleteStep methods are never released properly.

 

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 6
(4,498 Views)
Hi Norbert,

Thanks for you suggestion tried modifying the source code as suggested by you.I got the Sequences handle on click of button and passed the same sequenceFile handle as reference parameter to Delete and insert step.

Then i released the handle to sequenceFile by call  Engine.ReleaseSequenceFileEx() .After closing TS sequence editor i didn't get memory leak issue,but i can see that my sequence files are not modified. I'm completely clue less which sequncefile is modified. I cross checked to see if i had passed correct sequence file path,and found path was valid.

 

Sample code:

private void ModifyTXT_btn_Click(object sender, EventArgs e)
        {
            strTXTfilePath = GetVariablevalue(TXTFile_ExpEdit);
            SeqFile = TSEngine.GetSequenceFileEx(strTXTfilePath, 107, TypeConflictHandlerTypes.ConflictHandler_Error);
          
            DeleteSteps(ref SeqFile);
            InsertStep(ref SeqFile);
          
            //Release handle to TXT file
            TSEngine.ReleaseSequenceFileEx(SeqFile, 0x0);
            SeqFile = null;
        }

 

 //DeleteOperation

private void DeleteSteps(ref SequenceFile ClientSeqFile )
        {
            try
            {
                SequenceToModify = ClientSeqFile.GetSequenceByName("DestinationSequence");

                //Delete all the Fx statement present in the SubSequence of Client Sequence File
              }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

 

//Insert Operation

 

private void InsertStep(ref SequenceFile ClientSeqFile)
        {
            try
            {

                SequenceToModify = ClientSeqFile.GetSequenceByName("DestinationSequence");

                Sequence SourceSequence = ClientSeqFile.GetSequenceByName("SourceSequence");
                string strAddFieldName = "TestStep";
                //Create an Instance of Statement step type                     
              
                SequenceToModify.InsertStep(NewStep, 0, StepGroups.StepGroup_Main);
            
            }
            catch (Exception ex1)
            {
                MessageBox.Show(ex1.Message);
            }
        }

 

 Please have i look if i'm doing it correctly.

 

Thanks in advance

 

Regards

VDC
0 Kudos
Message 3 of 6
(4,453 Views)
Solution
Accepted by topic author VDC

VDC,

 


VDC wrote:
[...]After closing TS sequence editor i didn't get memory leak issue,but i can see that my sequence files are not modified. I'm completely clue less which sequncefile is modified. I cross checked to see if i had passed correct sequence file path,and found path was valid.[...]

 

I take from this that the memory leak is gone which is infact good news. On the other hand, i understand that your sequence is not changed. How do you check on this?

You do not save any changes to file. Is this desired?

You can check the behavior in a simple test:

Create a new sequence file in the Sequence Editor and save it. Open (in parallel) for instance the default C#-User Interface installed with TestStand in the editor mode. Load the sequence file there.

It now has to be opened in the Sequence Editor as well as in the user interface. In the user interface, add a new action step to the sequence. Please note the in the user interface, the sequence file is marked with a *-symbol which means there are unsaved changes. Switch to the Sequence Editor. You will see that no changes appear in the sequence view.

Switch back to the user interface. Save the sequence file. The *-symbol will disappear.

If you switch to the Sequence Editor again, you will get notified, that the sequence file has been altered by an external process. You can now load the changes into Sequence Editor.

 

Question: Is this what you are seeing?

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 4 of 6
(4,451 Views)

Hi Norbert,

 

Thanks alot.

I was able to solve the memory leak issue with your help. As i have passed the modified sequence reference i din't get memory leak issue,but changes in the sequence file were not reflected.

 

To solve this issue i did this.

 

            PropertyObjectFile Seq_PropObjFile = SeqFile.AsPropertyObjectFile();

           Seq_PropObjFile.IncChangeCount();
            SeqFile.Save(strHTMLfilePath);
           
            TSEngine.ReleaseSequenceFileEx(SeqFile, 0x0);
            SeqFile = null;

 

I got the propertyObjectfile of sequence to modify,then incremented the count by call of  Seq_PropObjFile.IncChangeCount() and teststand Sequence Editor got to knon that sequence file was modified.And finally saved the sequence file at same location.

 

I thankfully appreciate your help.

 

Regards

VDC

0 Kudos
Message 5 of 6
(4,433 Views)

Does TestStand not keep a 1 for 1 relationship for GetSequenceFileEx/ReleaseSequenceFileEx?

 

Our Model generates 3 sepearate executions to perform background type functions while the client file executes.  Each of those executions will make sequence calls to myfile.seq.  For reasons I don't want to go in to, in the client file we want to get a reference to myfile.seq via GetSequenceFileEx and insert a sequence in to it at run time.  When the client file is done, we no longer need this inserted sequence and I'd like to call ReleaseSequenceFileEx and be done with it, but my guess is this call sees that myfile.seq is still being used by the other executions and won't release.

 

Then when I close TestStand I get the memory leak warnings.  Short of turning off the warnings via Debug Options, is there anything else that can be done.  Using TestStand 2012.

0 Kudos
Message 6 of 6
(3,117 Views)