From c2663ebee8a15d6762ae6d574efb8c92ba26bedc Mon Sep 17 00:00:00 2001 From: SlicelessBread <48603220+SlicelessBread@users.noreply.github.com> Date: Sun, 15 Nov 2026 15:35:27 +0100 Subject: [PATCH] fix(lab): Fast Lab builds no longer run out of memory on 8 GB devices (#2667) --- tools/agent/dd-lab-build | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/agent/dd-lab-build b/tools/agent/dd-lab-build index b29c6bc5a6..4f5671dc04 100755 --- a/tools/agent/dd-lab-build +++ b/tools/agent/dd-lab-build @@ -113,11 +113,10 @@ if [ ! -d "$ANDROID_HOME/platforms/android-34" ]; then "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" "platforms;android-34" "build-tools;35.0.0" >/dev/null fi -# A full Kotlin compile of the app needs about 2.5 GB of heap and Gradle about 1 GB; smaller devices get -# what they can spare. Both daemons end with this script's process when the build is done. -total_mb=$(awk '/^MemTotal:/ {print int($2 / 1024)}' /proc/meminfo) -heap=$(( total_mb / 2 )); [ $heap -gt 4096 ] && heap=4096; [ $heap -lt 2048 ] && heap=2048 -heap=${DD_LAB_HEAP_MB:-$heap} +# A full Kotlin compile of the app runs out of memory with 2.4 GB of heap, and Gradle needs about 1 GB, +# so devices with less memory to spare swap rather than fail. Both daemons end with this script's +# process when the build is done. +heap=${DD_LAB_HEAP_MB:-4096} kotlin_heap=$(( heap * 2 / 3 )); gradle_heap=$(( heap - kotlin_heap )) # Only the Kotlin daemon compiles incrementally; in-process compiles always redo the whole app, and the