Skip to content

Commit 6ef9878

Browse files
authored
Complete fixing the daemon leaks (#1206 fixes #1194)
2 parents 21b089f + b9e8325 commit 6ef9878

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

plugin-gradle/CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`).
44

55
## [Unreleased]
6+
### Fixed
7+
* More daemon memory consumption fixes ([#1206](https://github.com/diffplug/spotless/pull/1198) fixes [#1194](https://github.com/diffplug/spotless/issues/1194))
68

79
## [6.6.0] - 2022-05-10
810
### Added

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ static class LiveCacheKeyImpl<T> implements LiveCache<T>, Serializable {
5454

5555
@Override
5656
public void set(T value) {
57-
if (value instanceof LazyForwardingEquality) {
58-
// whenever we cache an instance of LazyForwardingEquality, we want to make sure that we give it
59-
// a chance to null-out its initialization lambda (see https://github.com/diffplug/spotless/issues/1194#issuecomment-1120744842)
60-
LazyForwardingEquality.unlazy((LazyForwardingEquality<?>) value);
61-
}
57+
58+
// whenever we cache an instance of LazyForwardingEquality, we want to make sure that we give it
59+
// a chance to null-out its initialization lambda (see https://github.com/diffplug/spotless/issues/1194#issuecomment-1120744842)
60+
LazyForwardingEquality.unlazy(value);
6261
daemonState.put(internalKey, value);
6362
}
6463

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021 DiffPlug
2+
* Copyright 2021-2022 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@
2121
import org.gradle.api.Action;
2222
import org.gradle.api.Project;
2323

24+
import com.diffplug.spotless.LazyForwardingEquality;
25+
2426
public class SpotlessExtensionPredeclare extends SpotlessExtension {
2527
private final SortedMap<String, FormatExtension> toSetup = new TreeMap<>();
2628

@@ -33,6 +35,8 @@ public SpotlessExtensionPredeclare(Project project, GradleProvisioner.Policy pol
3335
lazyAction.execute(formatExtension);
3436
}
3537
getRegisterDependenciesTask().steps.addAll(formatExtension.steps);
38+
// needed to fix Deemon memory leaks (#1194), but this line came from https://github.com/diffplug/spotless/pull/1206
39+
LazyForwardingEquality.unlazy(getRegisterDependenciesTask().steps);
3640
});
3741
});
3842
}

0 commit comments

Comments
 (0)