Kotlin / dokka

API documentation engine for Kotlin
https://kotl.in/dokka
Apache License 2.0
3.45k stars 409 forks source link

java.lang.OutOfMemoryError: Java heap space #3885

Open mahozad opened 4 weeks ago

mahozad commented 4 weeks ago

Describe the bug When upgrading Dokka from 1.9.20 to 2.0.0-Beta, executing dokkaGenerate task fails:

...
> Task :wavy-slider:dokkaGenerateModuleHtml
> Task :wavy-slider:dokkaGeneratePublicationHtml

java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid37140.hprof ...
java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid20352.hprof ...
Heap dump file created [804336399 bytes in 7.145 secs]

> Task :wavy-slider:dokkaGenerateModuleHtml FAILED
Heap dump file created [804312093 bytes in 6.518 secs]
> Task :wavy-slider:dokkaGeneratePublicationHtml FAILED

Expected behaviour Should generate HTML output.

To Reproduce Please checkout this commit and apply the below dokka configs in library/build.gradle.kts and run ./gradlew wavy-slider:dokkaGenerate

Dokka configuration gradle.properties:

org.jetbrains.dokka.experimental.gradle.pluginMode=V2EnabledWithHelpers

library/build.gradle.kts:

dokka {
    moduleName = "Hello"

    dokkaSourceSets.configureEach {
        reportUndocumented = true
        enableJdkDocumentationLink = true
        enableAndroidDocumentationLink = true
        enableKotlinStdLibDocumentationLink = true
        jdkVersion = libs.versions.java.get().toInt()
    }

    pluginsConfiguration.html {
        customStyleSheets.from(file("../asset/logo-styles.css"))
        customAssets.from(file("../asset/logo-icon.svg"))
        separateInheritedMembers = true
    }
}

Installation

Additional context Dokka 1.9.20 worked properly.

whyoleg commented 3 weeks ago

Hey! Yeah, that's because Gradle Plugin v2 uses a bit different way of running Dokka generator/engine by default. We are thinking of changing it. In the meanwhile, you can do that explicitly:

dokka {
    dokkaGeneratorIsolation = ClassLoaderIsolation()
}

For more information on what it does, you can take a look on updated extensive KDoc.

mahozad commented 3 weeks ago

Thank you. that resolved the problem.

SakurajimaMaii commented 2 weeks ago

Gradle version should also be above 8.10

ShreckYe commented 2 weeks ago

@whyoleg should this be added to the subprojects (the convention plugin), or the root project, or both, if I have a multi-module build?

SakurajimaMaii commented 2 weeks ago

@whyoleg should this be added to the subprojects (the convention plugin), or the root project, or both, if I have a multi-module build?

You can take a look at my project, maybe it can help you https://github.com/SakurajimaMaii/Android-Vast-Extension/tree/preview/kotlin-2.0.0/libraries

ShreckYe commented 2 weeks ago

@SakurajimaMaii OK thanks.