Skip to content

Commit 2a963f4

Browse files
committed
Don't capture the FormatExtension in LiveCache
Fixed memory leak caused by capturing the Gradle project model referenced by the LineEndings Provider stored in the JvmLocalCache. Fixes #2067
1 parent aa113ff commit 2a963f4

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

plugin-gradle/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
55
## [Unreleased]
66
### Fixed
77
* Ignore system git config when running tests ([#1990](https://github.com/diffplug/spotless/issues/1990))
8+
* Fixed memory leak introduced in 6.21.0 ([#2067](https://github.com/diffplug/spotless/issues/2067))
89
### Changes
910
* Bump default `ktfmt` version to latest `0.46` -> `0.47`. ([#2045](https://github.com/diffplug/spotless/pull/2045))
1011
* Bump default `sortpom` version to latest `3.2.1` -> `3.4.0`. ([#2049](https://github.com/diffplug/spotless/pull/2049))

plugin-gradle/src/main/java/com/diffplug/gradle/spotless/FormatExtension.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,8 +1067,9 @@ protected void setupTask(SpotlessTask task) {
10671067
}
10681068
task.setSteps(steps);
10691069
Directory projectDir = getProject().getLayout().getProjectDirectory();
1070+
LineEnding lineEndings = getLineEndings();
10701071
task.setLineEndingsPolicy(
1071-
getProject().provider(() -> getLineEndings().createPolicy(projectDir.getAsFile(), () -> totalTarget)));
1072+
getProject().provider(() -> lineEndings.createPolicy(projectDir.getAsFile(), () -> totalTarget)));
10721073
spotless.getRegisterDependenciesTask().hookSubprojectTask(task);
10731074
task.setupRatchet(getRatchetFrom() != null ? getRatchetFrom() : "");
10741075
}

0 commit comments

Comments
 (0)