Skip to content

Classes are not unloaded after BCV tasks #281

@osipxd

Description

@osipxd

After running BCV tasks, Gradle doesn’t free up metaspace memory.
For example, in the Ktor project, each run of apiDump uses up to 4GB of metaspace memory (#281). The only way to free up this memory is to restart Gradle Daemon.

Here is an example of four consecutive launches of ./gradlew apiDump --rerun-tasks in the Ktor project.
image

It is a known Gradle bug:

Steps to reproduce

  1. Clone Ktor repository
    git clone git@github.com:ktorio/ktor.git
  2. Run VisualVM or any other VM monitoring tool
  3. Run ./gradlew apiDump --rerun-tasks several times
  4. Look at metaspace usage by Gradle Daemon process in VisualVM

Possible workaround

Some projects use processIsolation instead of classLoaderIsolation (cortinico/ktfmt-gradle#206, sigstore/sigstore-java#283). Could this solution be used for BCV?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions