jvm arguments are not getting applied via command line parameter
See original GitHub issueI’m trying to profile a build with different -Xmx
sizes.
I’m using -D<key>=<value>
: to override default heap settings. I assume it should work because of isssue https://github.com/gradle/gradle-profiler/issues/101
Unfortunately parameter does not getting applied.
I added jvmArguments logging to ToolingApiInvoker.java
runTasks method.
Gradle plugin 5.4.1, MacOS
sampleProfile.scenarios
default-scenarios = ["incremental_build"]
incremental_build {
tasks = ["assemble"]
apply-abi-change-to = "app/src/main/java/com/example/myapplication/LongOperation.java"
daemon = cold // value can be "warm", "cold", or "none"
clear-build-cache-before = SCENARIO
clear-transform-cache-before = SCENARIO
show-build-cache-size = true
#jvm-args = ["-Xmx2500m"]
}
First try with -D paramter
gradle-profiler --benchmark --scenario-file ~/sampleProfile.scenarios --project-dir ~/AndroidStudioProjects/MyApplication/ --output-dir ~/tmp/1 incremental_build -Dorg.gradle.jvmargs="-Xmx2500m"
ToolingApiInoker runtasks()
jvmArgs [-Xmx1536m, -Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=en, -Duser.variant, -Dorg.gradle.jvmargs=-Xmx2500m, -Dorg.gradle.profiler.scenario=incremental_build, -Dorg.gradle.profiler.phase=WARM_UP, -Dorg.gradle.profiler.number=1, -Dorg.gradle.profiler.step=BUILD]
And VisualVM shows that Xmx is default 1536
second try, with jvm-args
in scenario
gradle-profiler --benchmark --scenario-file ~/sampleProfile.scenarios --project-dir ~/AndroidStudioProjects/MyApplication/ --output-dir ~/tmp/2 incremental_build
ToolingApiInoker runtasks()
jvmArgs [-Xmx1536m, -Dfile.encoding=UTF-8, -Duser.country=RU, -Duser.language=en, -Duser.variant, -Xmx2500m, -Dorg.gradle.profiler.scenario=incremental_build, -Dorg.gradle.profiler.phase=WARM_UP, -Dorg.gradle.profiler.number=1, -Dorg.gradle.profiler.step=BUILD]
VisualVM shows that Xmx is applied and is Xmx2500m
I want to be able to change jvm arguments dynamically, so I can run script that will find optimal heap/workers combination. Looks like this is not currently possible due to a bug or unsupported feature.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
@android10 I see that you use
-P
in./gradlew -Porg.gradle.jvmargs=-Xmx16g wrapper
, but-P
means gradle project property, using-D
e.g../gradlew -Dorg.gradle.jvmargs=-Xmx16g wrapper
means that the property will be used by gradle and jvm. I’ve tried with-D
and works well.I think this issue can be closed. The replies suggest profiler was re-using daemons from regular
./gradlew
builds (not sure this was the behavior before), but the current behavior is profiler uses its ownGRADLE_USER_HOME
, so it doesn’t share daemons with such builds. It also stops all of its own daemons before benchmarks. Thus I don’t see how this could occur today.