Skip to content

Unlazy collections/delegates #1206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`).

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

## [6.6.0] - 2022-05-10
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@ static class LiveCacheKeyImpl<T> implements LiveCache<T>, Serializable {

@Override
public void set(T value) {
if (value instanceof LazyForwardingEquality) {
// whenever we cache an instance of LazyForwardingEquality, we want to make sure that we give it
// a chance to null-out its initialization lambda (see https://github.com/diffplug/spotless/issues/1194#issuecomment-1120744842)
LazyForwardingEquality.unlazy((LazyForwardingEquality<?>) value);
}

// whenever we cache an instance of LazyForwardingEquality, we want to make sure that we give it
// a chance to null-out its initialization lambda (see https://github.com/diffplug/spotless/issues/1194#issuecomment-1120744842)
LazyForwardingEquality.unlazy(value);
daemonState.put(internalKey, value);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021 DiffPlug
* Copyright 2021-2022 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,6 +21,8 @@
import org.gradle.api.Action;
import org.gradle.api.Project;

import com.diffplug.spotless.LazyForwardingEquality;

public class SpotlessExtensionPredeclare extends SpotlessExtension {
private final SortedMap<String, FormatExtension> toSetup = new TreeMap<>();

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