# Gradle-worker.jar process using too much memory

**URL:** <https://discuss.gradle.org/t/gradle-worker-jar-process-using-too-much-memory/5102>\
**Category:** Old Forum Archive\
**Created:** [August 8, 2014, 4:01pm UTC](https://discuss.gradle.org/t/gradle-worker-jar-process-using-too-much-memory/5102 "2014-08-08T16:01:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyler\_Williamson](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/tyler_williamson/32/942_2.png) [@Tyler\_Williamson](https://discuss.gradle.org/u/Tyler_Williamson)\
**Post date:** [August 8, 2014, 4:01pm UTC](https://discuss.gradle.org/t/gradle-worker-jar-process-using-too-much-memory/5102/1 "2014-08-08T16:01:00Z")

</div>

I have supplied -Xmx1024 in GRADLE\_OPTS and in gradle.properties, but a java -cp gradle-worker.jar process is taking over 4gigs of memory, how do I configure this process to use a fixed amount of memory? The CI platform we’re using only allows a combined 4gigs across all of the containers.

Here is the memory usage report:

PID

RSS %CPU COMMAND

5433 4425544 96.5 /usr/lib/jvm/jdk1.7.0/bin/java -javaagent:/home/ubuntu/.gradle/caches/modules-2/files-2.1/com.newrelic.agent.android/class-rewriter/3.407.0/6f7f95a36369f76b739461331202406fa1f519c7/class-rewriter-3.407.0.jar -Dandroid.assets=/home/ubuntu/Android/app/build/intermediates/assets/debug -Dandroid.manifest=/home/ubuntu/Android/app/build/intermediates/manifests/debug/AndroidManifest.xml -Dandroid.resources=/home/ubuntu/Android/app/build/intermediates/res/debug -Djava.security.manager=jarjar.org.gradle.process.internal.child.BootstrapSecurityManager -Dfile.encoding=UTF-8 -ea -cp /home/ubuntu/.gradle/caches/1.10/workerMain/gradle-worker.jar jarjar.org.gradle.process.internal.launcher.GradleWorkerMain

5045 415676 117 /usr/lib/jvm/jdk1.7.0/bin/java -XX:MaxPermSize=512m -Xmx512m -Dfile.encoding=UTF-8 -cp /usr/local/gradle-1.10/lib/gradle-launcher-1.10.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 1.10 /home/ubuntu/.gradle/daemon 120000 51920caf-a858-47db-97b9-036de3e1de7c -XX:MaxPermSize=512m -Xmx512m -Dfile.encoding=UTF-8

4780 326000 7.0 /usr/lib/jvm/jdk1.7.0/bin/java -Xmx1024m -XX:MaxPermSize=1024m -Dorg.gradle.appname=gradle -classpath /usr/local/gradle-1.10/lib/gradle-launcher-1.10.jar org.gradle.launcher.GradleMain --info --project-dir /home/ubuntu/Android/app test

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [August 11, 2014, 2:44am UTC](https://discuss.gradle.org/t/gradle-worker-jar-process-using-too-much-memory/5102/2 "2014-08-11T02:44:00Z")

</div>

GRADLE\_OPTS controls the Gradle process itself. Processes that Gradle launches are controlled by the task that launches them.

So, what is the 5433 process? Is this running tests?

---

<div class="post-metadata">

**Author:** ![Tyler\_Williamson](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/tyler_williamson/32/942_2.png) [@Tyler\_Williamson](https://discuss.gradle.org/u/Tyler_Williamson)\
**Post date:** [August 11, 2014, 4:13am UTC](https://discuss.gradle.org/t/gradle-worker-jar-process-using-too-much-memory/5102/3 "2014-08-11T04:13:00Z")

</div>

Hey, turned out that java was allocating way too much memory if maxHeapSize isnt specified in the test DSL. Setting maxHeapSize in the test (robolectric) DSL resolved the issue.

Thanks!
