build: right-size Kotlin daemon heap from 12g/4g to 8g/2g

Measured the actual Kotlin daemon peak RSS during a full cold compile
of :amethyst:compilePlayDebugKotlin (which transitively compiles
:quartz, :commons, :quic, :nestsClient as well, in parallel after the
earlier parallel-mode change). Peak RSS was ~6.3 GB at the previous
12g/4g setting, meaning heap usage peaked around 4-5 GB plus
metaspace and native memory.

Drops to -Xmx8g -XX:MaxMetaspaceSize=2g, which:

- Cuts committed-virtual-memory ask from 18 GB (Gradle 6g + Kotlin 12g)
  to 14 GB, comfortably under typical CI runner RAM and well under the
  15 GB available in this dev environment.
- Frees ~4 GB of headroom for the OS file cache, which speeds up
  classpath snapshot I/O on incremental builds.
- Leaves clear headroom over peak usage so GC pressure stays low; we
  re-measured cold compile after the change at 3m30s vs 3m34s before,
  well within run-to-run noise.
- Peak Kotlin daemon RSS at the new setting: 4.96 GB, confirming the
  daemon right-sizes itself rather than pinning the ceiling.

If a much larger codebase target lands later (e.g. iOS framework
compilation in this same daemon), bump back up — the value is not
sacred, it just shouldn't request more than the host can afford.
This commit is contained in:
Claude
2026-05-16 14:54:44 +00:00
parent 2e8bf0d45d
commit 66df23fc2c
+1 -1
View File
@@ -24,7 +24,7 @@ kotlin.code.style=official
android.nonTransitiveRClass=true android.nonTransitiveRClass=true
android.enableR8.fullMode=true android.enableR8.fullMode=true
kotlin.daemon.jvmargs=-Xmx12g -XX:MaxMetaspaceSize=4g kotlin.daemon.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=2g
# because we use a custom jvmAndroid target # because we use a custom jvmAndroid target
kotlin.mpp.applyDefaultHierarchyTemplate=false kotlin.mpp.applyDefaultHierarchyTemplate=false