# GradleWorker process using too much memory

**URL:** <https://discuss.gradle.org/t/gradleworker-process-using-too-much-memory/1186>\
**Category:** Old Forum Archive\
**Created:** [April 7, 2014, 8:24am UTC](https://discuss.gradle.org/t/gradleworker-process-using-too-much-memory/1186 "2014-04-07T08:24:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tobiasen](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@Tobiasen](https://discuss.gradle.org/u/Tobiasen)\
**Post date:** [April 7, 2014, 8:24am UTC](https://discuss.gradle.org/t/gradleworker-process-using-too-much-memory/1186/1 "2014-04-07T08:24:00Z")

</div>

Hi,

I have a project that use 3GB memory for compiling. When I run tests then gradle first start a GradleWorkerMain that compiles. That java process will consume 3GB memory while compiling. The gradle will start a new process for tests but the original GradleWorkerMain will continue to reserve 3GB of memory (since the JVM is reluctant to release memory). After a while Linux will start killing processes due to high memory consumption.

I have a workaround. If I run ./gradlew test

then it will run out of memory.

But if I instead run ./gradlew testClasses ./gradlew test the it will not run out of memory.

Is there a better way of doing this? Is there a way to configure gradle to shutdown gradleworkers when done compiling?

I am using 1.10.

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [April 7, 2014, 4:17pm UTC](https://discuss.gradle.org/t/gradleworker-process-using-too-much-memory/1186/2 "2014-04-07T16:17:00Z")

</div>

Do you compile a huge set of classes in one go? Do you use in-process or forked compilation? Have you tried to configure memory settings for (forked) compilation tasks?
