Fix memory leak

Using a lazy val causes the log manager to hold onto a reference to the
state. These would accumulate with each task evaluation. I found that
that in the beanpuree project, that if I ran compile 10 times in a row,
the heap usage was 40mb lower after this change.
This commit is contained in:
Ethan Atkins 2019-05-26 18:28:27 -07:00
parent f8d729cd3b
commit 20f6d22439
1 changed files with 1 additions and 1 deletions

View File

@ -174,7 +174,7 @@ object LogManager {
key: ScopedKey[_],
state: State
): SuppressedTraceContext => Option[String] = {
lazy val display = Project.showContextKey(state)
val display = Project.showContextKey(state)
def commandBase = "last " + display.show(unwrapStreamsKey(key))
def command(useFormat: Boolean) =
if (useFormat) BLUE + commandBase + RESET else s"'$commandBase'"