I know it may look like a duplicate of How to disable Gradle daemon in IntelliJ Idea?, but I don't want to completely disable gradle daemon. I just want to use only one daemon, not many of them.
The problem I have is that to successfully run some gradle tasks I have to give about 2GB RAM to gradle. And my system only had 8GB of memory.
The problem is that when I perform certain actions (I think it's "refresh gradle projects", there are 2 of them) - I sometiems get 2 or more gradle daemons running. Each consuming 2GB of memory.
Is it possible to use only one daemon or somehow automatically stop those extra daemons?
You can stop all currently running daemons with gradlew --stop
. New deamons are only created if necessary. If e. g. a different Java version is used or different daemon arguments are needed and so on. You could maybe look with Sysinternals ProcessExplorer and compare the two processes to find where they differ to find a reason why two are created.