sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #04667
[Bug 825216] Re: X-1.0-rc3: Java: java.lang.OutOfMemoryError: Java heap space at long run
this not a real bug.
The situation can be avoided, when respecting the general rules to avoid
memory leaks.
** Description changed:
+ ***** the problem comes up, using the following loop:
+
+ int count = 1;
+ Screen s;
+ while (true) {
+ s = new Screen();
+ System.out.println("Count = "+ count++);
+ s.click("start.png", 0);
+ }
+
+ this seems to bind some internal objects, so that GC is not able to free
+ heap memory.
+
+ Since this is generally not "good programming" (no need for a new Screen
+ object at each loop turn), the recommended approach does not fill up the
+ heap:
+
+ int count = 1;
+ Screen s = new Screen();
+ while (true) {
+ System.out.println("Count = "+ count++);
+ s.click("start.png", 0);
+ }
+
+ ----------------------------------------------------------------------------
+
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
+ 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
+ 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:
+ 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)
+ 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)
** Summary changed:
- X-1.0-rc3: Java: java.lang.OutOfMemoryError: Java heap space at long run
+ Java: how to avoid java.lang.OutOfMemoryError: Java heap space at long run
** Changed in: sikuli
Status: New => Invalid
** Converted to question:
https://answers.launchpad.net/sikuli/+question/168247
--
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:
Java: how to avoid java.lang.OutOfMemoryError: Java heap space at long
run
Status in Sikuli:
Invalid
Bug description:
***** the problem comes up, using the following loop:
int count = 1;
Screen s;
while (true) {
s = new Screen();
System.out.println("Count = "+ count++);
s.click("start.png", 0);
}
this seems to bind some internal objects, so that GC is not able to
free heap memory.
Since this is generally not "good programming" (no need for a new
Screen object at each loop turn), the recommended approach does not
fill up the heap:
int count = 1;
Screen s = new Screen();
while (true) {
System.out.println("Count = "+ count++);
s.click("start.png", 0);
}
----------------------------------------------------------------------------
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