Is it possible to limit the amount of kotlin and gradle daemons? I'm working on a mpp library and an...
p
Is it possible to limit the amount of kotlin and gradle daemons? I'm working on a mpp library and an android application simulatenously and now I have the double amount of ram consumption. I'm on 32gig ram but that still pushes my system to the limit
v
If your system is running low on RAM, Gradle should automatically end own idle processes. To minimize creation of new daemons, you need to use the same versions (Gradle, Java, Kotlin), use the same memory settings like
Xmx
, and not run two builds at the same time, because then the daemons can be reused. Another (bad) option would be to disable the daemon, but then you loose the performance benefits, which is not only the startup time, but many more performance optimizations.
t
by default Kotlin deamon will use the same amount of memory as Gradle daemon, but sometimes it is too much. You could set Kotlin daemon memory size explicetly.
k
You can also add the --no-daemon flag. We found that the daamons staying around after builds used more memory than it was worth the slight incremental build speed improvement...
😦 1
v
That's what I said, disable the daemon, either by flag or by property. But it is a pretty bad option. There is not only a slight performance increase. There are several features that are the not working like file system watching, caching up-to-date information, startup time and so on.
k
Compared to swapping, that's minor. E.g. on our old 16gb macbooks, it would beach ball for most of the build....totally lock up the UI so you couldn't use the machine 😞 Took us a year of begging and jumping through hoops to get 32gb laptops and now our builds are 3x faster...
t
how big is your project? 🤔
k
700k LoC...250 modules
v
You could also change the idle timeout of the daemon btw. By default it is 3 hours after which it kills itself out of boredom. But you can make it more instabil by using
org.gradle.daemon.idletimeout