Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

Precompute message in order not to leak Project instance #1188

Merged
merged 2 commits into from
Oct 17, 2018

Conversation

eskatos
Copy link
Member

@eskatos eskatos commented Oct 17, 2018

The KotlinCompile task logger goes through RMI to the Kotlin Compiler daemon. Holding a Project instance per task exacerbated a memory leak in the Kotlin compiler infrastructure.

This only impacted KotlinCompile tasks with the kotlin-dsl plugin applied.

Also see https://youtrack.jetbrains.com/issue/KT-27639

The KotlinCompile task logger goes through RMI to the Kotlin Compiler
daemon. Holding a Project instance per task exacerbated a memory leak
in the Kotlin compiler infrastructure.

Signed-off-by: Paul Merlin <paul@gradle.com>
Copy link
Contributor

@JLLeitschuh JLLeitschuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

to preallocate two smaller strings ahead and build the whole message
when it's actually needed

Signed-off-by: Paul Merlin <paul@gradle.com>
@eskatos eskatos merged commit e8ec5dd into develop Oct 17, 2018
@eskatos eskatos deleted the eskatos/perf/fix-rmi-leak branch October 17, 2018 17:29
@eskatos
Copy link
Member Author

eskatos commented Nov 14, 2018

If you can't use Gradle 5 and are impacted by this leak, setting kotlinDslPluginOptions.experimentalWarning.set(false) in all your projects that apply the kotlin-dsl plugin will short-circuit the leaky code path.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants