sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #26223
[Question #249674]: memory leak
New question #249674 on Sikuli:
https://answers.launchpad.net/sikuli/+question/249674
Dear all,
my code is here:
import logging
import datetime
from javax.swing import JFrame, JPanel, JLabel, JSplitPane
from java.awt import BorderLayout
loopcount = 60
def SetText(state):
label1.text = state+"/"+str(loopcount)
def SysLog(msg):
#moment = datetime.datetime.now()
logging.info(msg)
frame = JFrame("Info")
frame.setSize(200, 60);
frame.setLocation(1920 / 2 -100, 960);
frame.setLayout(BorderLayout())
label1 = JLabel("Debug Panel1")
panel1 = JPanel()
panel1.add(label1)
frame.add(panel1)
#label1.text = state
frame.setVisible(True)
logging.basicConfig(filename='example.log',level=logging.DEBUG)
r = Region(278,260,402,313);
#while not r.exists(Pattern(img).similar(0.99), 0):
while(1):
c=0
reset_time=0
img = capture(r)
wait(1)
while (1):
if(r.exists(Pattern(img).similar(0.999), 0)):
SysLog("Same")
c += 1
else:
SysLog("Different")
c = 0
reset_time += 1
wait(1)
img = capture(r)
wait(1)
SetText(str(c))
if(c > loopcount):
break
print ("reset time=" + str(reset_time))
SysLog("Timeout, do something")
SetText("Timeout, do something")
It has heavy memory leak problem, after 1-hour run or shorter, it crashed because of memory leaking. I have to do "taskkill /im java.exe /f /t" command to force down the JVM, I don't know how to solve it.
I have googled and found that may Region,exists(img) cause memory leak. How can I modify my code to do the same logic with other function?
Thanks in advanced.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.