-XX:ReservedCodeCacheSize=576M
This is slightly higher than the amount of CodeCache space required by `./busytown/androidx.sh` according to 'jcmd ${GradleDaemonPid} Compiler.codecache'
Before this change, when I run `./busytown/androidx.sh`, `jcmd ${GradleDaemonPid} Compiler.codecache` tells me that the compilation cache was reset a bunch of times:
stopped_count=283, restarted_count=283
After this change, when I run `./busytown/androidx.sh`, `jcmd ${GradleDaemonPid} Compiler.codecache` tells me that the compilation cache didn't need to be reset:
stopped_count=0, restarted_count=0
So, hopefully this will be an effective workaround for https://bugs.openjdk.org/browse/JDK-8295724 before we upgrade to a new version of Java.
Also, when I test this on my computer I find that this change reduces the time of the first Gradle run in busytown/androidx.sh from:
BUILD SUCCESSFUL in 36m 58s
to
BUILD SUCCESSFUL in 32m 24s
Bug: 260643754
Test: Treehugger runs busytown/*.sh
Change-Id: I36f4e0b350a95ecbb1b527160d40ce5a6a8ede8f
diff --git a/gradlew b/gradlew
index f302889..9b54b57 100755
--- a/gradlew
+++ b/gradlew
@@ -36,6 +36,9 @@
# tell Gradle where to put a heap dump on failure
ORG_GRADLE_JVMARGS="$(echo $ORG_GRADLE_JVMARGS | sed "s|$| -XX:HeapDumpPath=$DIST_DIR|")"
+ # Increase the compiler cache size: b/260643754 . Remove when updating to JDK 20 ( https://bugs.openjdk.org/browse/JDK-8295724 )
+ ORG_GRADLE_JVMARGS="$(echo $ORG_GRADLE_JVMARGS | sed "s|$| -XX:ReservedCodeCacheSize=576M|")"
+
# We don't set a default DIST_DIR in an else clause here because Studio doesn't use gradlew
# and doesn't set DIST_DIR and we want gradlew and Studio to match
fi