← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #245115]: [sikuli-java] Share a Screen instance or re-create a new one

 

Question #245115 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/245115

    Status: Open => Answered

RaiMan proposed the following answer:
A Screen object (which inherits from Region) itself is lightweight,
since it only contains some numbers and some references. The only heavy
"reference" is the last screenshot. But since this is created and
changed with every find operation, this does not affect object creation
and the older captures are available to GC anyway.

In your case it does not matter anyway: each test case creates it's own
local environment, where all created objects are eligible for GC at exit
from the test case.

So taking into account the additional effort of passing around a global
screen object this does not make sense.

Conclusion: create Screen/Region objects wherever/whenever needed.
Reusing these objects can be restricted to the block context.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.