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?
1 Answer
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 --stopcommand. The--stopswitch 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-daemoncommand-line option, or by addingorg.gradle.daemon=falseto yourgradle.propertiesfile. 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 :
4Why 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.