From 66df23fc2c947e4457a7a52f3b6832be9d919811 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 16 May 2026 14:54:44 +0000 Subject: [PATCH] build: right-size Kotlin daemon heap from 12g/4g to 8g/2g MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 67adc89fd..050eafd47 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,7 +24,7 @@ kotlin.code.style=official android.nonTransitiveRClass=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 kotlin.mpp.applyDefaultHierarchyTemplate=false