Ask a Question

Memory/Performance leak around JS scripts (OCR) - Does not happen with a code snippet


Memory/Performance leak around JS scripts (OCR) - Does not happen with a code snippet

I have a suite of keyword tests with a small number of JS scripts to access object methods not available otherwise.


These is OCR.Recognize and DetectTable were incorporated into a script as a one-line function.


When the script was called within keyword tests it was noticed test execution visibly slowed until they ground to a halt. 


Performance counters were added to allow monitoring of memory and CPU% at every test step but nothing unusual was noted.


When the script was converted to a code snippet and the issue was "solved".


This page seems to highlight something similar.


However TestComplete should look after garbage collection once the script is closed.  I do not think that's happening.


This is the script:


function Get_Table_Cell_script(Row_param, Col_param)
	var Text = OCR.Recognize(Aliases.Reflection_app.MCS_UAT_form.MCS_Display).DetectTable(spNone, false).Cell(Row_param, Col_param).Text;



The above was initially written with intermediate objects that were "nullified" before exiting.


The equivalent code snippet is:


OCR.Recognize(Aliases.Reflection_app.MCS_UAT_form.MCS_Display).DetectTable(spNone, false).Cell(KeywordTests.Get_Table_Cell.Variables.Row_local, KeywordTests.Get_Table_Cell.Variables.Col_local).Text



We do not want to use code snippets because they are messy and difficult to maintain and can only be used for the basics.


We have a lot other TC test suites that use scripts and have not seen this issue.


Is it related to the OCR objects?

Community Hero

That sounds like something that you should discuss with Support directly.  Here's their link:

[Community Hero]
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.

I've just done it.  Thanks.  Took a while to isolate that.

Showing results for 
Search instead for 
Did you mean: