# How to optimize memory usage on a meta project building other projects?

**URL:** <https://discuss.gradle.org/t/how-to-optimize-memory-usage-on-a-meta-project-building-other-projects/2911>\
**Category:** Old Forum Archive\
**Created:** [July 28, 2014, 6:36am UTC](https://discuss.gradle.org/t/how-to-optimize-memory-usage-on-a-meta-project-building-other-projects/2911 "2014-07-28T06:36:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kavin\_kankeshwar](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/kavin_kankeshwar/32/624_2.png) [@kavin\_kankeshwar](https://discuss.gradle.org/u/kavin_kankeshwar)\
**Post date:** [July 28, 2014, 6:36am UTC](https://discuss.gradle.org/t/how-to-optimize-memory-usage-on-a-meta-project-building-other-projects/2911/1 "2014-07-28T06:36:00Z")

</div>

I have a meta gradle project which is building other gradle projects, it clones does builds/releases for other project, it keeps throwing error

```gradle
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"

```

even though in my gradle.properties i have

```gradle
GRADLE_OPTS="-Xmx1024m -Xms256m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError”

```

And i tried bumping up Xmx to 4 GB and still it keeps failing. Individual projects build separately just fine. Is there some way i can optimize grade’s memory usage ?

I am not sure how can i fix it,
