03-16-2012 05:54 AM
Hi,
I was found some answers from previous questions on those issues, but still need help. So, after using TS_Obj_SeqFile SequenceFileHandle, I try to release with (first save to file):
tsErrChkMsgPopup( TS_SeqFileSave ( SequenceFileHandle, &errorInfo, SeqTarget_path )); tsErrChkMsgPopup( TS_EngineReleaseSeqFileEx (EngineHandle, &errorInfo, SequenceFileHandle, TS_ReleaseSeqFile_DoNotRunUnloadCallback, &removedfromCache)); error= CA_DiscardObjHandle ( SequenceFileHandle ); error= CA_DiscardObjHandle ( EngineHandle);
However, removedfromCache is still False and obviously function was not work (if it is work, should be True-> -1). Eror message said that SeqTarget_path was not released (and some other properties). I use two files for SequenceFileHandle (SeqTemplate_path and SeqTarget_path). First is default file and some additions are with this and second is file where saved all changes.
Is there some other way to handle this ?
best regards,
branar
Solved! Go to Solution.
03-16-2012 09:54 AM
You must have multiple load references. Release needs to be called for every reference to the file. Perhaps the file is also open in the sequence editor or UI?
-Doug
03-19-2012 01:57 AM
Hi Doug,
First, I load some default file and after that create content in object SequenceHandle / SequenceFileHandle. After that, it is copied to new file (with SequenceFileHandle and new filename). Do you think that both need to have "own" SequenceFileHandle ? New content is created adding new to default sequence file and saved as new seq (with new name). Loading of file is basically connected only to default file. Still, release not work for target file (this file is only saved, not called into seq. editor or UI). Only connection to this file is by SequenceFileHandle. However, default file is released probably by EngineHandle and there are no errors related to default file.
best regards,
branar
03-19-2012 09:53 AM
Please attach a sequence file or example code which reproduces the problem. I think that would be the easiest way to see what you are doing. Ideally, if you can do this using a sequence file with API calls directly in expressions, that would be the easiest for us to use.
-Doug
03-20-2012 01:16 AM
while( iLineParsed ){ if (strncmp( szSubSequence, "MainSequence",12) == 0) { // Main sequence is coded in separate place iLineParsed = parseNextLine(FILE_tests, szLine, szName, szTestType, szStepID, szRow, szSubSequence); } else { //it is not MainSequence //Subsequence tsErrChkMsgPopup( TS_EngineGetSeqFileEx (EngineHandle, &errorInfo, SeqTemplate_path, TS_GetSeqFile_DoNotRunLoadCallback, TS_ConflictHandler_Prompt, &SequenceFileHandle)); tsErrChkMsgPopup( TS_SeqFileGetSequenceByName (SequenceFileHandle, NULL, szSubSequence, &SequenceHandle)); tsErrChkMsgPopup( TS_SequenceGetNumSteps(SequenceHandle, &errorInfo, TS_StepGroup_Main, &iNumofSteps)); if( strcmp(szTestType,"M") == 0 ){ //Multiple Numeric Limit Test tsErrChkMsgPopup( TS_EngineNewStep (EngineHandle, &errorInfo, "C/CVI Flexible Prototype Adapter", "NI_MultipleNumericLimitTest", &StepHandle)); tsErrChkMsgPopup( TS_StepSetName ( StepHandle, NULL, szName)); // write in Test_meas measurements sprintf(buffer,"%s,%s",szName, szSubSequence); error = WriteStringToFile (FILE_meas, buffer); //fwrite (buffer, 45, 1, FILE_meas); iLineParsed = parseNextLine(FILE_tests, szLine, szName, szTestType, szStepID,szRow, szSubSequence); iIndex = 0; while(strcmp(szTestType,"S") == 0 && iLineParsed){ //add submeasurements in seq addSubMeasurement( iIndex, szName ); iLineParsed = parseNextLine(FILE_tests, szLine, szName, szTestType, szStepID, szRow, szSubSequence); iIndex++; } //while } // end of M else if( strcmp(szTestType,"N") == 0 ){ //Numeric Limit Test tsErrChkMsgPopup( TS_EngineNewStep (EngineHandle, &errorInfo, "C/CVI Flexible Prototype Adapter", "NumericLimitTest", &StepHandle)); tsErrChkMsgPopup( TS_StepSetName ( StepHandle, NULL, szName)); //write in File_meas measurements sprintf(buffer,"%s,%s",szName, szSubSequence); error = WriteStringToFile (FILE_meas, buffer); tsErrChkMsgPopup( TS_PropertySetValString( StepHandle, &errorInfo, "Comp", 0, "GELE" )); iLineParsed = parseNextLine(FILE_tests, szLine, szName, szTestType, szStepID, szRow, szSubSequence); } else iLineParsed = parseNextLine(FILE_tests, szLine, szName, szTestType, szStepID, szRow, szSubSequence); if( StepHandle ){ // add dll file tsErrChkMsgPopup( TS_PropertySetValString( StepHandle, &errorInfo, "TS.SData.Call.LibPath", 0, "FETS2.dll" )); tsErrChkMsgPopup( TS_SequenceInsertStep ( SequenceHandle, &errorInfo, StepHandle, iNumofSteps, TS_StepGroup_Main )); StepHandle = 0; //} // end of stephandle } // end of M } // end of mainsequnce } //while tsErrChkMsgPopup( TS_SeqFileSave ( SequenceFileHandle, &errorInfo, SeqTarget_path )); while( iLineParsed ){ if (strncmp( szSubSequence, "MainSequence",12) == 0) { // Main sequence if ( strncmp( szTestType,"Label",5) == 0) { //main sequence Label, adapter None //add tsErrChkMsgPopup( TS_EngineGetSeqFileEx (EngineHandle, &errorInfo, SeqTarget_path, TS_GetSeqFile_DoNotRunLoadCallback, TS_ConflictHandler_Prompt, &SequenceFileHandle)); error= TS_SeqFileGetSequenceByName (SequenceFileHandle, NULL, "MainSequence", &SequenceHandle); tsErrChkMsgPopup( TS_SequenceGetNumSteps(SequenceHandle, &errorInfo, TS_StepGroup_Main, &iNumofSteps)); tsErrChkMsgPopup( TS_EngineNewStep (EngineHandle, &errorInfo, "", "Label", &labelStep)); tsErrChkMsgPopup( TS_StepSetName ( labelStep, NULL, szName)); tsErrChkMsgPopup( TS_SequenceInsertStep ( SequenceHandle, &errorInfo, labelStep, iNumofSteps, TS_StepGroup_Main )); } //end of Label if ( strncmp( szTestType,"Statement",9) == 0) { // Statement, adapter None, but if it is not, then is Pre Expression or Post Expression tsErrChkMsgPopup( TS_EngineGetSeqFileEx (EngineHandle, &errorInfo, SeqTarget_path, TS_GetSeqFile_DoNotRunLoadCallback, TS_ConflictHandler_Prompt, &SequenceFileHandle)); error= TS_SeqFileGetSequenceByName (SequenceFileHandle, NULL, "MainSequence", &SequenceHandle); tsErrChkMsgPopup( TS_SequenceGetNumSteps(SequenceHandle, &errorInfo, TS_StepGroup_Main, &iNumofSteps)); tsErrChkMsgPopup( TS_EngineNewStep (EngineHandle, &errorInfo, "", "Statement", &statementStep)); tsErrChkMsgPopup( TS_StepSetName ( statementStep, NULL, szName)); if (strncmp( szStepID, "Pre Expression",14) == 0) { tsErrChkMsgPopup( TS_StepSetPreExpression (statementStep, &errorInfo, szRow)); if (strncmp( szStepID, "Post Expression",15) == 0) { tsErrChkMsgPopup( TS_StepSetPostExpression (statementStep, &errorInfo, szRow)); } tsErrChkMsgPopup( TS_SequenceInsertStep ( SequenceHandle, &errorInfo, statementStep, iNumofSteps, TS_StepGroup_Main )); } } //end of statement // MessagePopup, adapter None, but if is is not-> Precondition if ( strncmp( szTestType,"MessagePopup",12) == 0) { tsErrChkMsgPopup( TS_EngineGetSeqFileEx (EngineHandle, &errorInfo, SeqTarget_path, TS_GetSeqFile_DoNotRunLoadCallback, TS_ConflictHandler_Prompt, &SequenceFileHandle)); error= TS_SeqFileGetSequenceByName (SequenceFileHandle, NULL, "MainSequence", &SequenceHandle); tsErrChkMsgPopup( TS_SequenceGetNumSteps(SequenceHandle, &errorInfo, TS_StepGroup_Main, &iNumofSteps)); tsErrChkMsgPopup( TS_EngineNewStep (EngineHandle, &errorInfo, "", "MessagePopup", &messageStep)); tsErrChkMsgPopup( TS_StepSetName ( messageStep, NULL, szName)); // code for precondition, description // tsErrChkMsgPopup( TS_StepSetPrecondition (messageStep, &errorInfo, szRow)); // tsErrChkMsgPopup( TS_StepTypeSetDescriptionExpr (messageStep, &errorInfo, "Connect port"); error = TS_FlexibleMsgPopup (messageStep, "Connect DUT ports", "Connect DUT cables as follows:PORT1 = ANT1, PORT2 = RX1, PORT3 = ANT2, PORT4 = TX1 Terminate RxExt1 Make sure that 50 ohm terminators are connected well !! ", "OK", "", "", "", 1, "", messageString, 4096, 1, 0 , 0 ,0 , 0 ); tsErrChkMsgPopup( TS_SequenceInsertStep ( SequenceHandle, &errorInfo, messageStep, iNumofSteps, TS_StepGroup_Main )); } // end of messafepopup // Action if ( strncmp( szTestType,"Action",6) == 0) { tsErrChkMsgPopup( TS_EngineGetSeqFileEx (EngineHandle, &errorInfo, SeqTarget_path, TS_GetSeqFile_DoNotRunLoadCallback, TS_ConflictHandler_Prompt, &SequenceFileHandle)); error= TS_SeqFileGetSequenceByName (SequenceFileHandle, NULL, "MainSequence", &SequenceHandle); tsErrChkMsgPopup( TS_SequenceGetNumSteps(SequenceHandle, &errorInfo, TS_StepGroup_Main, &iNumofSteps)); tsErrChkMsgPopup( TS_EngineNewStep (EngineHandle, &errorInfo, "", "Action", &actionStep)); tsErrChkMsgPopup( TS_StepSetName ( actionStep, NULL, szName)); tsErrChkMsgPopup( TS_SequenceInsertStep ( SequenceHandle, &errorInfo, actionStep, iNumofSteps, TS_StepGroup_Main )); } // end of action // SequenceCall if ( strncmp( szTestType,"SequenceCall",12) == 0) { tsErrChkMsgPopup( TS_EngineGetSeqFileEx (EngineHandle, &errorInfo, SeqTarget_path, TS_GetSeqFile_DoNotRunLoadCallback, TS_ConflictHandler_Prompt, &SequenceFileHandle)); error= TS_SeqFileGetSequenceByName (SequenceFileHandle, NULL, "MainSequence", &SequenceHandle); tsErrChkMsgPopup( TS_SequenceGetNumSteps(SequenceHandle, &errorInfo, TS_StepGroup_Main, &iNumofSteps)); tsErrChkMsgPopup( TS_EngineNewStep (EngineHandle, &errorInfo, "", "SequenceCall", &sequenceCallStep)); tsErrChkMsgPopup( TS_StepSetName ( sequenceCallStep, NULL, szName)); error= TS_StepGetModule ( sequenceCallStep, &errorInfo, &sequenceCallStepModule); error= TS_SequenceCallModuleSetUseCurrentFile ( sequenceCallStepModule, &errorInfo, VTRUE); //tsErrChkMsgPopup(TS_SeqFileSequenceNameExists (SequenceFileHandle, NULL,szName,&iExist)); error= TS_SequenceCallModuleSetSequenceName ( sequenceCallStepModule, &errorInfo, szName); //tsErrChkMsgPopup( TS_SequenceInsertStep ( SequenceHandle, &errorInfo, sequenceCallStepModule, iNumofSteps, TS_StepGroup_Main )); tsErrChkMsgPopup( TS_SequenceInsertStep ( SequenceHandle, &errorInfo, sequenceCallStep, iNumofSteps, TS_StepGroup_Main ));//oikein } // end of sequencecall iLineParsed = parseNextLine(FILE_tests, szLine, szName, szTestType, szStepID, szRow, szSubSequence);} else { iLineParsed = parseNextLine(FILE_tests, szLine, szName, szTestType, szStepID, szRow, szSubSequence);} } //while tsErrChkMsgPopup( TS_SeqFileSave ( SequenceFileHandle, &errorInfo, SeqTarget_path )); tsErrChkMsgPopup( TS_EngineReleaseSeqFileEx (EngineHandle, &errorInfo, SequenceFileHandle, TS_ReleaseSeqFile_DoNotRunUnloadCallback, &removedfromCache)); error= CA_DiscardObjHandle ( SequenceFileHandle ); error= CA_DiscardObjHandle ( EngineHandle);
Hi Doug,
This is code. Some explanation. First, I create subsequences (from txt file), after that insert in appropriate subsequences content. After that, save in new file. Next step is to add some content in MainSequence and finaly save in previously saved file. Releasing of objects after this step. here is code:
Problem came with last line and results is that SeqTarget_path is not released (as SequenceFile and some property object, also).
best regards,
branara
03-20-2012 02:46 AM
You dont appear to release the StepHandle or SequenceHandle. If there are any PorpertyObject Handles created then you will have to release them as well.
Also, but it's probably nothing to do with your error, but what handle do you enter your routine with. If it's the Engine Handle (which you don't appear to be creating in this code), then you shouldn't be releasing this at the end.
03-20-2012 03:15 AM
Hi Doug,
EngineHandle is created at stat of code and released as the last at the end. StepHandle and SequenceHandle were missing, but after add them, there no changes. This error was received. ReleaseSequenceFile(Ex) is related to SeqTarget_path.
I was released all of them as defined at begining of code. Still, some o f them are not equal to 0.
The Engine.ReleaseSequenceFile(Ex) method was not called for the following files: c:\temp\fets_all.seq References to PropertyObjects were not released properly. Total number of objects: 38171 Number of top-level objects: 4 Note: Some top-level objects may be included if they are referenced by an incorrectly released top-level object. For example, an unreleased SequenceContext object references a SequenceFile object. The following top-level objects were not released: Files [1 object(s) not released] SequenceFile #1: Path: c:\temp\fets_all.seq PropertyObjects [2 object(s) not released] PropertyObject #1: Type: Number Value: 0 PropertyObject #2: Type: Number Value: 0 And the following uncategoried objects: TypeUsageList (Obj)
03-20-2012 03:20 AM
Hi Doug,
Some objects are missing from releasing, but now added all (as is defined at begining of code). Still, I have error releted to Seqtarget_path:
The Engine.ReleaseSequenceFile(Ex) method was not called for the following files:
c:\temp\fets_all.seq
References to PropertyObjects were not released properly.
Total number of objects: 38171
Number of top-level objects: 4
Note: Some top-level objects may be included if they are referenced by
an incorrectly released top-level object. For example, an unreleased
SequenceContext object references a SequenceFile object.
The following top-level objects were not released:
Files [1 object(s) not released]
SequenceFile #1:
Path: c:\temp\fets_all.seq
PropertyObjects [2 object(s) not released]
PropertyObject #1:
Type: Number
Value: 0
PropertyObject #2:
Type: Number
Value: 0
And the following uncategoried objects:
TypeUsageList (Obj)
end of code:
error= CA_DiscardObjHandle ( StepHandle );
error= CA_DiscardObjHandle ( newSequence );
error= CA_DiscardObjHandle ( SequenceHandle );
error= CA_DiscardObjHandle ( subObj );
error= CA_DiscardObjHandle ( labelStep );
error= CA_DiscardObjHandle ( statementStep );
error= CA_DiscardObjHandle ( actionStep );
error= CA_DiscardObjHandle ( messageStep );
error= CA_DiscardObjHandle ( messageString );
error= CA_DiscardObjHandle ( sequenceCallStep );
error= CA_DiscardObjHandle ( SequenceFileHandle );
error= CA_DiscardObjHandle ( sequenceCallStepModule );
error= CA_DiscardObjHandle ( EngineHandle);
best regards,
branar
03-20-2012 03:39 AM
It's difficuilt to read your code snippet but you seem to be calling TS_EngineGetSeqFileEx multiple times in you loop, why are you doing this. You dont appear to be calling TS_EngineReleaseSeqFileEx other than at the end.
03-20-2012 03:48 AM
Hi,
I was hoped that it will be help to release SequenceFile object when object focus was changed from SeqTemplate_path to SeqTarget_path. Now is only one call to end, but error message is still same. If it si possible to find out those errors may be in seq file already created and perhaps to resolve those issues there ?
best regards,
branar