Compare commits

...

1 Commits

Author SHA1 Message Date
Claude
d52afdeda5 fix: cap daemon heaps so the Android CI job fits the 16 GB runner
CI `test-and-build-android` was failing with:

  Execution failed for task ':amethyst:compileFdroidBenchmarkKotlin'.
  > Not enough memory to run compilation. Try to increase it via
    'gradle.properties': kotlin.daemon.jvmargs=-Xmx<size>

The message is misleading: it is an OS allocation failure, not an
under-sized heap. GitHub `ubuntu-latest` runners have 16 GB RAM, and the
Android job runs with `org.gradle.parallel=true`, so the Gradle daemon
(-Xmx6g), a separate Kotlin compile daemon (-Xmx8g + 2g metaspace) and
forked test JVMs (`:quartz:jvmTest` at maxHeapSize=4g) are all resident
at once. The Kotlin daemon (8g) next to the Gradle daemon (6g) already
reserves 14 GB of ceiling; once `kotlinc` for the large `:amethyst`
module tries to grow toward 8g the box is out of physical pages and the
Build Tools API surfaces the OOM. Bumping the Kotlin daemon higher (what
the error suggests) only makes the over-commit worse.

Lower the ceilings so their sum stays comfortably under 16 GB:
- Gradle daemon 6g -> 5g
- Kotlin daemon 8g/2g -> 4g/1g

4g is plenty to compile a single module: verified by running the
previously-failing `:amethyst:compileFdroidBenchmarkKotlin` to
BUILD SUCCESSFUL on a comparable 4-vCPU / ~16 GB host with the new caps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LDyt8cWgUKz9Davd7UKCYc
2026-06-19 22:08:17 +00:00

View File

@@ -6,7 +6,17 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx6g -Dfile.encoding=UTF-8
#
# Heap ceilings are kept deliberately modest because CI (GitHub
# `ubuntu-latest`, 4 vCPU / 16 GB RAM) runs the Android job with
# `org.gradle.parallel=true`: the Gradle daemon, a separate Kotlin
# compile daemon, and forked test JVMs (e.g. `:quartz:jvmTest` at 4g) are
# all resident at once. An 8g Kotlin daemon next to a 6g Gradle daemon
# over-commits the 16 GB box, and `kotlinc` for the large `:amethyst`
# module then fails with "Not enough memory to run compilation" — an
# allocation failure from the OS, not an under-sized heap. Keep the sum
# of these ceilings comfortably under 16 GB.
org.gradle.jvmargs=-Xmx5g -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
@@ -24,7 +34,10 @@ kotlin.code.style=official
android.nonTransitiveRClass=true
android.enableR8.fullMode=true
kotlin.daemon.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=2g
# 4g is ample for compiling a single module (even the large `:amethyst`);
# the previous 8g over-committed the 16 GB CI runner — see the note on
# org.gradle.jvmargs above.
kotlin.daemon.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g
# because we use a custom jvmAndroid target
kotlin.mpp.applyDefaultHierarchyTemplate=false