Open doubleshow opened 11 years ago
From miglecz on January 21, 2013 19:50:00 I removed the code that uses the Canvas and the leak seems fixed. More experiment showed that it fills up the heap, GC can't help.
Runtime runtime = Runtime.getRuntime(); Canvas canvas = new DesktopCanvas(); ScreenRegion region = new DesktopScreenRegion(); for (;;) { canvas.addBox(region).display(0); canvas.clear(); System.out.println("heap MB: " + (runtime.totalMemory() - runtime.freeMemory()) / 1024 / 1024); }
From feferr...@gmail.com on February 05, 2013 18:22:17 I have the same problem but I didnt use Canvas objects in my code. I tried closing the InputStream in DesktopScreen.getScreenshot(DesktopScreen.java:35) but nothing change. The heap grow up until OutOfMemory exception is throwed
From mbdiwa...@gmail.com on March 21, 2013 00:13:19 I have the same exact issue, heap grows up until I get OOM I am using DesktopScreenRegion DesktopCanvas
From feferr...@gmail.com on March 21, 2013 14:43:40 This issue is fixed in unofficial version 1.0.3 http://code.google.com/p/sikuli-api/downloads/detail?name=sikuli-api-1.0.3-standalone-SNAPSHOT.jar&can=1&q=
From mbdiwa...@gmail.com on April 02, 2013 05:17:17 I tried unofficial version 1.0.3, Issue doesnt seem to be fixed,with every execution it seems the heap grows, jvisualvm shows reference
java.awt.image.BufferedImage#22 4,380,150 java.awt.image.BufferedImage#19 4,380,150 java.awt.image.BufferedImage#17 4,380,150 java.awt.image.BufferedImage#15 4,380,150 java.awt.image.BufferedImage#13 4,380,150 java.awt.image.BufferedImage#10 4,380,150 java.awt.image.BufferedImage#8 4,380,150 java.awt.image.BufferedImage#6 4,380,150 java.awt.image.BufferedImage#4 4,380,150 java.awt.image.BufferedImage#1 4,380,150
From doubles...@gmail.com on April 02, 2013 16:33:04 We are investigating this issue. There seems to be a leak related to some libraries we use to draw on the screen. What was the code you used that generate this buffer overflow error?
From ale...@seznam.cz on April 02, 2013 22:52:06 I have memory leak as well, but it disappeared after removing excesive calls to "new DesktopScreenRegion()". Now I create it only once and keep the reference for all operations that start on whole desktop screen.
From mbdiwa...@gmail.com on April 02, 2013 23:08:05 public void LoginToApplicationWith(String userName, String password) throws MalformedURLException { desktopScreenRegion = new DesktopScreenRegion(); desktopCanvas = new DesktopCanvas(); desktopCanvas.addBox(desktopScreenRegion); desktopCanvas.display(3); userName = userName + "\t"; ImageTarget imageTarget; imageTarget = new ImageTarget(new File((AGENT_USERNAME))); ScreenRegion fr = desktopScreenRegion.find(imageTarget);
if(fr != null){
ScreenRegion right = Relative.to(fr).right(50).getScreenRegion();
mouse.click(right.getCenter());
keyboard.type(userName);
keyboard.type(password);
}
else
{
System.err.print("unable to find user");
}
Mouse m = new DesktopMouse();
ImageTarget img = new ImageTarget(new File((AGENT_LOGIN1)));
ScreenRegion login = desktopScreenRegion.find(img);
if (login != null){
m.click(login.getCenter());
}else
{
System.err.print("Login is not enabled");
}
}
From jlgu...@gmail.com on June 10, 2013 17:40:11 I would recommend upping this issue to a high priority. There is no work around for it.
From doubles...@gmail.com on June 10, 2013 17:44:42 We will be releasing an update soon. We will definitely work on this memory leak issue. Thanks for your patience.
From igets...@gmail.com on June 13, 2013 09:06:00 the same problem, looking forward a fix
From doubles...@gmail.com on June 13, 2013 17:06:05 This is a pre-release that contains memory leak fixes. https://bitbucket.org/doubleshow/sikuli-api/downloads/sikuli-api.standalone-1.0.3-Pre-1.jar Please try and report back whether memory leak issue has been addressed. Thanks!
Original author: miglecz (January 19, 2013 06:41:04)
I run my app for a few hours and memory runs out and terminates.
stacktrace: java.lang.OutOfMemoryError: Java heap space at java.awt.image.DataBufferByte.<init>(Unknown Source) at java.awt.image.ComponentSampleModel.createDataBuffer(Unknown Source) at java.awt.image.Raster.createWritableRaster(Unknown Source) at javax.imageio.ImageTypeSpecifier.createBufferedImage(Unknown Source) at javax.imageio.ImageReader.getDestination(Unknown Source) at com.sun.imageio.plugins.png.PNGImageReader.readImage(Unknown Source) at com.sun.imageio.plugins.png.PNGImageReader.read(Unknown Source) at javax.imageio.ImageIO.read(Unknown Source) at javax.imageio.ImageIO.read(Unknown Source) at org.sikuli.api.robot.desktop.DesktopScreen.getScreenshot(DesktopScreen.java:35) at org.sikuli.api.DefaultScreenRegion.capture(DefaultScreenRegion.java:126) at org.sikuli.api.ImageTarget.getUnordredMatches(ImageTarget.java:122) at org.sikuli.api.DefaultTarget.doFindAll(DefaultTarget.java:93) at org.sikuli.api.MultiStateTarget.getUnordredMatches(MultiStateTarget.java:27) at org.sikuli.api.DefaultTarget.doFindAll(DefaultTarget.java:93) at org.sikuli.api.DefaultScreenRegion.findAll(DefaultScreenRegion.java:58) ...
In file DesktopScreen.java:35 sikuli source is: InputStream is = new ByteArrayInputStream(os.toByteArray()); return ImageIO.read(is);
Sikuli is not closing the 'is' stream here around. Comment in ImageIO.read(InputStream input) says that: "This method does not close the provided InputStream after the read operation has completed it is the responsibility of the caller to close the stream, if desired."
Is it closed elsewhere, it is intended as it is now or my memory leaks out elsewhere?
Original issue: http://code.google.com/p/sikuli-api/issues/detail?id=20