# Unrecognized VM option 'UseCGroupMemoryLimitForHeap'

**URL:** <https://discuss.circleci.com/t/unrecognized-vm-option-usecgroupmemorylimitforheap/37088>\
**Category:** Bug Reports\
**Tags:** java, memory-usage, android, mobile, 21\
**Created:** [August 17, 2020, 6:30pm UTC](https://discuss.circleci.com/t/unrecognized-vm-option-usecgroupmemorylimitforheap/37088 "2020-08-17T18:30:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maherhanafi](https://avatars.discourse-cdn.com/v4/letter/m/8e7dd6/32.png) [@maherhanafi](https://discuss.circleci.com/u/maherhanafi)\
**Post date:** [August 17, 2020, 6:30pm UTC](https://discuss.circleci.com/t/unrecognized-vm-option-usecgroupmemorylimitforheap/37088/1 "2020-08-17T18:30:18Z")

</div>

Hi,

We have been running CircleCI CI/CD on our Android project for quite some time now and today we started to see an error regarding the usage of **UseCGroupMemoryLimitForHeap** for the Virtual Machine when creating our executor:

Here is the error:

```
Picked up JAVA_TOOL_OPTIONS: -XX:MaxRAM=3G
Picked up _JAVA_OPTIONS: -Xmx3200m -XX:+UnlockExperimentalVMOptions - XX:+UseCGroupMemoryLimitForHeap
Unrecognized VM option 'UseCGroupMemoryLimitForHeap'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Exited with code exit status 1
CircleCI received exit code 1

```

Here the executor:

```
thrive-android-executor:
docker:
  - image: circleci/android:api-29
working_directory: ~/src
environment:
  _JAVA_OPTIONS: "-Xmx3200m -XX:+UnlockExperimentalVMOptions" # Temporarily removed for now: -XX:+UseCGroupMemoryLimitForHeap"
  JVM_OPTS: -Xmx3200m
  ## circle instances have 4g, set java maxram to 3G manually - java automatics are using bad data from cgroups and/or docker, so we have to manually override this.
  JAVA_TOOL_OPTIONS: "-XX:MaxRAM=3G"
  GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx3200m" -Dorg.gradle.parellel=false -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=4'
  TERM: dumb

```

Here is the job that fails:

```
download-android-dependencies:
description: "Download Android Dependencies"
steps:
  - run:
      name: Download Android Dependencies
      command: ./gradlew androidDependencies
```

---

<div class="post-metadata">

**Author:** ![Pawan](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/pawan/32/24016_2.png) [@Pawan](https://discuss.circleci.com/u/Pawan)\
**Post date:** [August 17, 2020, 6:45pm UTC](https://discuss.circleci.com/t/unrecognized-vm-option-usecgroupmemorylimitforheap/37088/2 "2020-08-17T18:45:38Z")

</div>

Hi,

We updated the Java version in Android images from 8 to 11. You can read more about that in our announcement of the change here.

> [@Android Convenience Image Moving to Java v11 on August 17th](https://discuss.circleci.com/t/android-convenience-image-moving-to-java-v11-on-august-17th/36601):
>
> There has been a lot of people asking for a Java/OpenJDK update in the Android Convenience Image for awhile now. AdoptOpenJDK has a great blog post explaining why they’re moving to Java v11 as their default as well. You can find that [here](https://blog.adoptopenjdk.net/2020/06/adoptopenjdk-11-new-default/). Last month I [posted a GitHub Issue](https://github.com/circleci/circleci-images/issues/494) discussing this change for August 2020, maybe sooner in July. Considering we’re already in July, we’re going to stick with an August date for this change, updating the image August 17th. Testing this change While not availab…

We recently added a support article about the changes customers may need to make

> **[Java Builds Fail With \`Unrecognized VM option 'UseCGroupMemoryLimitForHeap'\`](https://support.circleci.com/hc/en-us/articles/360048152911)**
>
> UseContainerSupport
> Java builds fail with the error:
> Unrecognized VM option 'UseCGroupMemoryLimitForHeap'Error: Could not create the Java Virtual Machine.Error: A fatal exception has occurred. Prog...

In your case, you’ll likely want to now add `UseContainerSupport` . This will make sure Java still uses cgroups to gather available memory information.

We do apologize for the disruption this causes your organization and please let us know of any other way we can be of assistance.

Regards,  
Pawan Bahuguna
