← Back to team overview

sikuli-driver team mailing list archive

[Bug 825216] Re: X-1.0-rc3: Java: java.lang.OutOfMemoryError: Java heap space at long run

 

I already thought about something like that.

Even if you make a new Screen object with every loop turn, Java GC
should get rid of the stuff (so it might be some thing to be checked
inside Sikuli).

Your approach is still not optimal:
to get the screen as an object to use the Sikuli features, it is sufficient to only once at the beginning say:

Screen s = new Screen();

So every time you want to address the whole screen use
s.sikuli_feature().

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/825216

Title:
  X-1.0-rc3: Java: java.lang.OutOfMemoryError: Java heap space at long
  run

Status in Sikuli:
  New

Bug description:
  I am running sikuli script from Java program in Win XP 32 bit
  platform. While running the same script iteratively for long time I am
  getting the "OutOfMemory" error which I suspect is because of the
  memory leak problem of sikuli.

  While running a simple script, I set the heap space of JVM to 1GB.
  With that, a simple script having 4 calls to API "click" and one call
  to API "exists", ran for around 2 hours and gave the following
  exception:

  Exception in thread "main" java.lang.reflect.InvocationTargetException
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
  der.java:58)
  Caused by: java.lang.OutOfMemoryError: Java heap space
          at java.awt.image.DataBufferInt.<init>(Unknown Source)
          at java.awt.image.Raster.createPackedRaster(Unknown Source)
          at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknow
  n Source)
          at java.awt.image.BufferedImage.<init>(Unknown Source)
          at sun.java2d.loops.GraphicsPrimitive.convertFrom(Unknown Source)
          at sun.java2d.loops.GraphicsPrimitive.convertFrom(Unknown Source)
          at sun.java2d.loops.MaskBlit$General.MaskBlit(Unknown Source)
          at sun.java2d.loops.Blit$GeneralMaskBlit.Blit(Unknown Source)
          at sun.java2d.pipe.DrawImage.blitSurfaceData(Unknown Source)
          at sun.java2d.pipe.DrawImage.renderImageCopy(Unknown Source)
          at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
          at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
          at sun.java2d.pipe.ValidatePipe.copyImage(Unknown Source)
          at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
          at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
          at org.sikuli.script.OpenCV.convertBufferedImageToByteArray(OpenCV.java:
  35)
          at org.sikuli.script.OpenCV.convertBufferedImageToMat(OpenCV.java:41)
          at org.sikuli.script.Finder.<init>(Finder.java:70)
          at org.sikuli.script.Region.doFind(Region.java:965)
          at org.sikuli.script.Region$RepeatableFind.run(Region.java:1168)
          at org.sikuli.script.Region$Repeatable.repeat(Region.java:1139)
          at org.sikuli.script.Region.wait(Region.java:453)
          at org.sikuli.script.Region.find(Region.java:333)
          at org.sikuli.script.Region.getLocationFromPSRML(Region.java:1065)
          at org.sikuli.script.Region.click(Region.java:562)

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/825216/+subscriptions


References