Status Update
Comments
uc...@google.com <uc...@google.com>
sg...@google.com <sg...@google.com> #3
Thank you for the report. The reason for the hue GC time is that the Java VM is getting close to OOM, and will keep GC'ing to free memory.
Is this consistently happening when building your project, or only after some time? How about when running with --no-daemon
, that is ./gradlew --no-daemon ...
does that complete compilation?
sg...@google.com <sg...@google.com> #5
Based on the comments on the
je...@google.com <je...@google.com>
ga...@google.com <ga...@google.com> #6
Thanks for filing the issue. It seems that the metadata rule that we use in the IDE to fetch code samples is causing some issues. Are you using Ivy repositories by any chance?
Also, is Another heap dump after GC.run
recorded after the build?
di...@gmail.com <di...@gmail.com> #7
Are you using Ivy repositories by any chance?
I don't believe so. At least, we haven't added any manually. Any surefire way to check?
Also, is
Another heap dump after GC.run
recorded after the build?
Yes. Both are.
ga...@google.com <ga...@google.com> #8
Thanks for the additional info. The issue is in the Gradle sync code. More specifically:
override fun execute(ctx: ComponentMetadataContext) {
val id = ctx.details.id
ctx.details.addVariant(SAMPLE_SOURCE_CLASSIFIER) {
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, getObjects().named(Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, getObjects().named(SAMPLE_SOURCE_CLASSIFIER))
}
withFiles {
addFile("${id.name}-${id.version}-$SAMPLE_SOURCE_CLASSIFIER.jar")
}
}
}
as the action passed to addVariant
captures ObjectFactory
which holds Project
reference causing the big leak.
di...@gmail.com <di...@gmail.com> #9
Nice!
Would that be fixed in studio, AGP, or both? If AGP, would a 4.0.x release be possible?
ga...@google.com <ga...@google.com> #10
The issue in is on the IDE side, and 4.1 and 4.2 are impacted. IDE 4.2.0-alpha08 and 4.1.1 (most likely) will contain the fix.
di...@gmail.com <di...@gmail.com> #11
🎉 Thank you!
ga...@gmail.com <ga...@gmail.com> #12
Any chance that the fix could still go into 4.1.0? The leak feels very significant and we already had to skip 4.0 because of lint issues.
ga...@google.com <ga...@google.com> #13
I will try to push the fix in 4.1, pending our release team approval.
ga...@gmail.com <ga...@gmail.com> #14
Thank you🤞
ga...@google.com <ga...@google.com> #15
The fix will be included in Android Studio 4.1.0-RC1. As already mentioned in #10, Android Studio 4.2.0-alpha08 will also be fixed.
Description
dexBuilder
failed, and the build spent a huge amount of time in GC. I wouldn't expect this with 4GB heap and the Kotlin compiler daemon in a separate process.Build: AI-201.7846.76.42.6682321, 202007151459,
AI-201.7846.76.42.6682321, JRE 1.8.0_242-release-1644-b01x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1920x1080
AS: 4.2 Canary 5; Kotlin plugin: 1.4-M3-release-Studio4.1-1; Android Gradle Plugin: 4.0.0; Gradle: 6.3; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: 3.10.2, from PATH: (not found)