aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src/main/kotlin
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2022-11-26 01:11:53 +0200
committerGitHub <noreply@github.com>2022-11-26 01:11:53 +0200
commit9ed17b64f0dd071afaa4f2e9c507937c4e9571d2 (patch)
treef218bedc28f66e1f7d803eae99c0ed1d5ac5cb84 /runners/gradle-plugin/src/main/kotlin
parentdc1f9d20f599ca8f9311b779645bc5e53784ca92 (diff)
downloaddokka-9ed17b64f0dd071afaa4f2e9c507937c4e9571d2.tar.gz
dokka-9ed17b64f0dd071afaa4f2e9c507937c4e9571d2.tar.bz2
dokka-9ed17b64f0dd071afaa4f2e9c507937c4e9571d2.zip
Fix OOME: Metaspace (#2678)
* Fix OOME: Metaspace * Add stress test * Run sample analysis from `Dispatchers.Default`
Diffstat (limited to 'runners/gradle-plugin/src/main/kotlin')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt9
1 files changed, 8 insertions, 1 deletions
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt
index a654f9d5..52e7d3df 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt
@@ -89,7 +89,14 @@ abstract class AbstractDokkaTask : DefaultTask() {
internal open fun generateDocumentation() {
DokkaBootstrap(runtime, DokkaBootstrapImpl::class).apply {
configure(buildDokkaConfiguration().toJsonString(), createProxyLogger())
- generate()
+ /**
+ * Run in a new thread to avoid memory leaks that are related to ThreadLocal (that keeps `URLCLassLoader`)
+ * Currently, all `ThreadLocal`s leaking are in the compiler/IDE codebase.
+ */
+ Thread { generate() }.apply {
+ start()
+ join()
+ }
}
}