Skip to content

spotless gradle plugin leaks memory (massively) #1194

Closed
@lkoe

Description

@lkoe

From my preliminary analysis of instabilities in our build environment I suspect that spotless gradle plugin is massively leaking memory in the gradle daemon.

It seems that via GitAttributesLinieEndings$RelocatablePolicy the JVMLocalCache holds onto complete project references, which cannot be collected by a full gc of the daemon process.

spotless-leak

The image shows a full gc after the build of one of our projects (admittedly one having about 35 subprojects), with spotless applied vs. spotless not applied.
Also shown a GC root analysis on the daemon heap dump, showing the suspected offender.

The expectation would be that spotless only caches calculated values (and using weak cache values that could be collected if need be).

Using spotless-gradle-plugin 6.5.2

Gradle 7.3.3
------------------------------------------------------------

Build time:   2021-12-22 12:37:54 UTC
Revision:     6f556c80f945dc54b50e0be633da6c62dbe8dc71

Kotlin:       1.5.31
Groovy:       3.0.9
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          11.0.12 (Amazon.com Inc. 11.0.12+7-LTS)
OS:           Windows 10 10.0 amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions