Skip to content

OutOfMemoryError due to LineEndingsPolicy in JvmLocalCache #2067

Closed

Description

@jhonnen

I'm seeing sporadic OutOfMemoryErrors caused by the data retained in JvmLocalCache:
image

The large retention is caused by Gradle internal objects referenced by the line endings policy:
image

Gradle 8.6 with enabled configuration cache
Spotless Gradle 6.25.0
Windows 11

Activity

  1. jhonnen commented on Mar 18, 2024

    @jhonnen
    ContributorAuthor

    The large retention is caused by Gradle internal objects referenced by the line endings policy:

    More specifically, it's the captured FormatExtension in the provider's lambda, so the following hack seems to work around that:

    tasks.withType(SpotlessTask).configureEach {
        def fixedProvider = provider(LineEnding.UNIX::createPolicy)
        doFirst {
            setLineEndingsPolicy(fixedProvider)
        }
    }
    

    (setupTask is configured in afterEvaluate, so I needed to override the policy during execution time)

  2. jhonnen commented on Mar 19, 2024

    @jhonnen
    ContributorAuthor

    the captured FormatExtension seems to be a regression introduced by #1777

  3. added a commit that references this issue on Mar 19, 2024
    2a963f4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions