Fellow developers, how much memory are you all giv...
# gradle
a
Fellow developers, how much memory are you all giving to gradle daemon and kotlin daemon for android projects ? I am struggling with 8Gigs each for an android project of around 200 modules.
m
I'm at 8GB for a lot less modules ~30
a
Is it KMP projects?
m
Yes
(8GB for org.gradle.jvmargs here, default for kotlin daemon here)
e
For 200 modules I was using ~12gb
g
-Xmx5g -XX:MaxMetaspaceSize=3g for almost 700 modules project, Android/JVM, no MPP But for faster builds (and if someone want to run lint locally) we recommend devs to set more memory in their ~/.gradle/gradle.properties, at least 8-12gb instead
w
There’s also question what kinds of modules these are — pure Kotlin/JVM modules, or I expect even KMM ones, will take less memory than Android modules. For Android library modules, the more variants they have, the more memory they’ll consume too (ideally most Android library modules would contain only single
debug
or
release
variant)
1
g
Yep, those are important points, no one really should use multiple variants of library modules, only do this for app Though, I think KMM will consume more memory than raw Android, but it would be an interesting to measure
s
~700 Android modules
Copy code
kotlin.daemon.jvmargs=-Xmx5g -XX:+UseParallelGC
a
Wow 5g for 700 android modules is impressive.
r
~80 modules and 250k lines of kotlin code in an Android native project. 7g for the gradle daemon and 4g for the kotlin daemon
I wonder hose having hundreds of modules how many LOC do you have?
a
around 500k LOC , but kapt is there and I guess that increases the memory consumption
t
when you have one fat module (many LoC) - then Kotlin daemon will need much more memory to compile it because compiler needs it to analyze all the code and dependencies in that module. And yes - reducing amount of dependencies for the module also helps here.