Skip to content

Commit

Permalink
tune jvm args for nowinandroid with links and reasoning
Browse files Browse the repository at this point in the history
  • Loading branch information
kaeawc committed Sep 21, 2024
1 parent 12ea7d1 commit fde8615
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,23 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Ensure important default jvmargs aren't overwritten. See https://github.com/gradle/gradle/issues/19750
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -XX:+UseG1GC -XX:SoftRefLRUPolicyMSPerMB=1 -XX:ReservedCodeCacheSize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:+UnlockExperimentalVMOptions -Xmx4g -Xms4g -XX:MetaspaceSize=256m
kotlin.daemon.jvmargs=-Dfile.encoding=UTF-8 -XX:+UseG1GC -XX:SoftRefLRUPolicyMSPerMB=1 -XX:ReservedCodeCacheSize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:+UnlockExperimentalVMOptions -Xmx4g -Xms4g -XX:MetaspaceSize=256m
#
# For more information about how Gradle memory options were chosen:
# - Metaspace See https://www.jasonpearson.dev/metaspace-in-jvm-builds/
# - SoftRefLRUPolicyMSPerMB would default to 1000 which with a 4gb heap translates to ~51 minutes.
# A value of 1 means ~4 seconds before SoftRefs can be collected, which means its realistic to
# collect them as needed during a build that should take seconds to minutes.
# - CodeCache normally defaults to a very small size. Increasing it from platform defaults of 32-48m
# because of how many classes can be loaded into memory and then cached as native compiled code
# for a small speed boost.
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -XX:+UseG1GC -XX:SoftRefLRUPolicyMSPerMB=1 -XX:ReservedCodeCacheSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx4g -Xms4g

# For more information about how Kotlin Daemon memory options were chosen:
# - Kotlin JVM args only inherit Xmx, ReservedCodeCache, and MaxMetaspace. Since we are specifying
# other args we need to specify all of them here.
# - We're using the Kotlin Gradle Plugin's default value for ReservedCodeCacheSize, if we do not then
# the Gradle JVM arg value for ReservedCodeCacheSize will be used.
kotlin.daemon.jvmargs=-Dfile.encoding=UTF-8 -XX:+UseG1GC -XX:SoftRefLRUPolicyMSPerMB=1 -XX:ReservedCodeCacheSize=320m -XX:+HeapDumpOnOutOfMemoryError -Xmx4g -Xms4g

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
Expand Down

0 comments on commit fde8615

Please sign in to comment.