Fixed
Status Update
Comments
[Deleted User] <[Deleted User]> #2
I can confirm that this issue is blocking large project. On a "medium project" of 680 modules, the heap dump of the gradle daemon was taking 6.6 Gb after a sync. And the GradleAnalyticsEnvironment
was holding more than 3gb of strongly referenced objects.
Removing these references cleared the heapdump to 404 Mb.
The problem was that the providerFactory retains the DefaultListenerManager and all the gradle build listener, and yes, GradleAnalyticsEnvironment
was referenced itself as the singleton instance of Environment
.
[Deleted User] <[Deleted User]> #3
Here is screenshot of the heap dump.
Description
GradleAnalyticsEnvironment is references by static field of com.android.tools.analytics.Environment across builds, which prevents GC from removing much of the Gradle state as ProviderFactory retains it.
We should make sure to clean up the state after the build finishes.