Your build has exceeded the memory limit of 4G on 1 container

After updating gradle project to new version, i see error “Your build has exceeded the memory limit of 4G on 1 container.”

Му memory-usage.txt
PID RSS %CPU COMMAND
17779 2295832 126 /usr/lib/jvm/jdk1.8.0/bin/java -XX:+HeapDumpOnOutOfMemoryError -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /home/ubuntu/.gradle/wrapper/dists/gradle-4.2.1-all/domrskppdhf3wtn5mziw0c2zr/gradle-4.2.1/lib/gradle-launcher-4.2.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 4.2.1

I use:
machine:
environment:
GRADLE_OPTS: ‘-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"’

I imagine the error message is self-explanatory. Have you tried reducing the memory allocated to Java? What happens if you reduce the -Xmx2048m? I’d try 1G or 1.5G.

I am not particularly familiar with Java, but I recall when I’ve tweaked NetBeans, there are several memory settings to change in the JRE. It may be worth looking at several.

I tryed. Without results((

I’m at the risk of stating the obvious, but at the very least, you’d need to show readers in detail what you tried. There’s no point in folks giving you suggestions that you have already considered.

What other memory settings have you found and experimented with?

Thanks, @halfer )
configurations:

machine:
  environment:
    GRADLE_OPTS: '-Dorg.gradle.jvmargs="-noverify -Xmx4608M -XX:+HeapDumpOnOutOfMemoryError"'
    _JAVA_OPTIONS: "-Xms512m -Xmx1024m"

machine:
  environment:
    GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx4608M -XX:+HeapDumpOnOutOfMemoryError"'
    _JAVA_OPTIONS: "-Xms512m -Xmx4608m"

machine:
  environment:
    GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
    _JAVA_OPTIONS: "-Xms512m -Xmx1024m"

not use GRADLE_OPTS & _JAVA_OPTIONS


machine:
  environment:
    GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'

machine:
  environment:
    GRADLE_OPTS: -Xmx3g -Xms3g

machine:
  environment:
    GRADLE_OPTS: -Xmx4g -Xms4g
    _JAVA_OPTIONS: -Xmx4g -Xms4g

Im running into the same problem

I have a machine with 8gb

and this is my conf:

machine:
    environment:
      GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"'

default: &defaultJob
  docker:
      - image: circleci/android:api-25-alpha
  resource_class: large

Im running v2 of circle, and have a workflow of 7 jobs working, If I restart the failed one, it pass.

I have tryed, more memory, less memory in the config for gradle, I didn’t change the ‘resource_class’, because I believe that ‘large’ its enough.

1 Like