← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #691654]: Sikuli script consuming a lot of RAM

 

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

    Status: Answered => Open

Javier Gonzales Rodriguez is still having a problem:
Hi Raiman,

About this issue, I just found this...

Try this simple code:

ImgRegion = Region(542,235,232,204)
desktopImg = "desktopImg.png"
IconRegion = Region(1291,722,64,39)           #choose a region with 4 different icons in there.
IconImg = "IconImg.png"
running = True

def stopScript(event):
    global running
    running = False
 
Env.addHotkey(Key.ESC, KeyModifier.CTRL, stopScript)


while running:
    try:
        if ImgRegion.exists(desktopImg):
            ImgRegion.click(Pattern(desktopImg))            
            sleep(1)
        if IconRegion.exists(IconImg):
            IconRegion.click(Pattern(desktopImg))
            sleep(1)
        pass
    except:
        pass

- Stop the code and check your RAM, then change this:
IconImg = "IconImg.png"   #choose an different image on the same IconRegion

- Run the code again and stop it, repeat the last step (change the image
on the variable IconImg) and check your RAM.

So, basically Sikuli saves RAM for each image that found (reg.exists),
in my real scenario am looking an image on a big region, the image is
the same but it appears in different points inside of that region so,
sikuli is taking it like a new img and is saving and saving RAM until I
run out of RAM and it stops the script.

So my questions is ... if i have a loop, how I force to release the RAM
where sikuli already saved matches before my next loop?

Note: If I close the SikuliX IDE, it release the RAM, that can be
another solution but i rather to know how to do it inside a
loop/function/etc

Thanks!

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.