Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded #360

Closed
bachhavdipak opened this issue Jan 25, 2023 · 1 comment
Closed

Comments

@bachhavdipak
Copy link

Getting OutOfMemoryError while executing the below code:

    @Test
    public void testScreenShot() throws IOException, InterruptedException {

        getDriver().get("http://demo.automationtesting.in/Register.html");

        WebElement logoImage = getDriver().findElement(By.cssSelector("#imagetrgt"));
        BufferedImage expectedImage = ImageIO.read(new File("C:\\Data\\fullPageScreenshot.png"));
        Screenshot logoImageScreenshot = new AShot().takeScreenshot(getDriver(), logoImage);
        BufferedImage actualImage = logoImageScreenshot.getImage();


        ImageDiffer imageDiffer = new ImageDiffer();
        ImageDiff diff = imageDiffer
                .withDiffMarkupPolicy(new PointsMarkupPolicy()
                        .withDiffColor(Color.YELLOW))
                .withIgnoredColor(Color.MAGENTA)
                .makeDiff(expectedImage, actualImage);

        boolean areImagesDifferent = diff.hasDiff();
        if (areImagesDifferent) {
            System.out.println("Images are not Same");
        } else {
            System.out.println("Images are Same");
        }

        // driver.close();
    }

Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.util.LinkedHashMap.newTreeNode(LinkedHashMap.java:271)
at java.util.HashMap$TreeNode.putTreeVal(HashMap.java:2005)
at java.util.HashMap.putVal(HashMap.java:638)
at java.util.HashMap.put(HashMap.java:612)
at java.util.HashSet.add(HashSet.java:220)
at ru.yandex.qatools.ashot.comparison.PointsMarkupPolicy.addDiffPoint(PointsMarkupPolicy.java:41)
at ru.yandex.qatools.ashot.comparison.ImageDiff.addDiffPoint(ImageDiff.java:51)
at ru.yandex.qatools.ashot.comparison.ImageDiffer.markDiffPoints(ImageDiffer.java:81)
at ru.yandex.qatools.ashot.comparison.ImageDiffer.makeDiff(ImageDiffer.java:57)
at ru.yandex.qatools.ashot.comparison.ImageDiffer.makeDiff(ImageDiffer.java:96)
at starter.wikipedia.image.testScreenShot(image.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$133/1201004240.apply(Unknown Source)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall$$Lambda$134/1123236701.apply(Unknown Source)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.ExecutableInvoker$$Lambda$307/1592840862.apply(Unknown Source)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)

@valfirst
Copy link
Collaborator

Duplicate of #359

@valfirst valfirst marked this as a duplicate of #359 Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants