Why does OpenJDK Platform Binary stucks open and use too much ram?

10,213

This is a documented behaviour of gradle. You can see this stackoverflow answer and this closed issue in the flutter github project.

Daemon processes will automatically terminate themselves after 3 hours of inactivity. If you wish to stop a Daemon process before this, you can either kill the process via your operating system or run the gradle --stop command. The --stop switch causes Gradle to request that all running Daemon processes, of the same Gradle version used to run the command, terminate themselves.

You can disable it permanently by following these steps :

The Gradle Daemon is enabled by default, and we recommend always enabling it. You can disable the long-lived Gradle daemon via the --no-daemon command-line option, or by adding org.gradle.daemon=false to your gradle.properties file. You can find details of other ways to disable (and enable) the Daemon in Daemon FAQ further down.

You can find an explanation here about why the daemon is important for performance :

Why the Gradle Daemon is important for performance

The Daemon is a long-lived process, so not only are we able to avoid the cost of JVM startup for every build, but we are able to cache information about project structure, files, tasks, and more in memory.

The reasoning is simple: improve build speed by reusing computations from previous builds. However, the benefits are dramatic: we typically measure build times reduced by 15-75% on subsequent builds. We recommend profiling your build by using --profile to get a sense of how much impact the Gradle Daemon can have for you.

Share:
10,213

Related videos on Youtube

hakanAkdogan
Author by

hakanAkdogan

Updated on June 04, 2022

Comments

  • hakanAkdogan
    hakanAkdogan almost 2 years

    I started learning flutter recently and i noticed even if vscode closed OpenJDK Platform Binary stays open and uses too much ram. Should i force close it on task manager everytime i finished working on vscode? Is there any way to automatically close it? enter image description here

    • Lakatos Gyula
      Lakatos Gyula almost 3 years
      Do you use Gradle? It might be the Gradle daemon running in the background.
    • hakanAkdogan
      hakanAkdogan almost 3 years
      The project that i created with vscode "flutter new aplication project" has a gradle file in it but i don't really know.
  • hakanAkdogan
    hakanAkdogan almost 3 years
    Thank you for your answer, so is there any harm of force close in task manager?
  • Mohamed AMAZIRH
    Mohamed AMAZIRH almost 3 years
    You're welcome. No there is no harm in closing it via the task manager. In the official docs, using the task manager is one of the methods to close it . You can also do a gradle --stop command to stop it. The daemon is used to avoid the cost of the jvm startup time when a gradle command is executed. You can disabled permanently by following these steps.
  • hakanAkdogan
    hakanAkdogan almost 3 years
    Thank you so much!
  • Mohamed AMAZIRH
    Mohamed AMAZIRH almost 3 years
    You're welcome! Glad to have been of help