Skip to content

Very High Memory Consumption #234

Closed
Closed

Description

@dpkass

What happened?

The java extension somehow uses 10GB+ of RAM, while the other 7-8 language servers (typescript) combined consistently use less than 300MB.

What did you expect to happen?

Much lower memory usage.

Environment

Zed: v1.0.1 (had the same issue on the last few v0.x)
Platform: macOS 15.5
Java: 25.0.2

I have a mid sized project, that's split into ~5 support libraries and 2 main services, each its own gradle project. Maybe having multiple gradle projects is the issue?

Activity

  1. added theissue type on May 4, 2026
  2. tartarughina commented on May 4, 2026

    @tartarughina
    Collaborator

    Which process is using a lot of memory? Is it the java-lsp-proxy or one of its child processes?
    If the latter, we might seriously start to consider adding user defined min and max memory.

    In the initialization script for jdtls, which we have embedded in Rust code, only the min is set to 1GB

    let mut args = vec![
            path_to_string(java_executable)?,
            "-Declipse.application=org.eclipse.jdt.ls.core.id1".to_string(),
            "-Dosgi.bundles.defaultStartLevel=4".to_string(),
            "-Declipse.product=org.eclipse.jdt.ls.core.product".to_string(),
            "-Dosgi.checkConfiguration=true".to_string(),
            format!(
                "-Dosgi.sharedConfiguration.area={}",
                path_to_string(shared_config_path)?
            ),
            "-Dosgi.sharedConfiguration.area.readOnly=true".to_string(),
            "-Dosgi.configuration.cascaded=true".to_string(),
            "-Djava.import.generatesMetadataFilesAtProjectRoot=false".to_string(),
            "-Xms1G".to_string(),
            "--add-modules=ALL-SYSTEM".to_string(),
            "--add-opens".to_string(),
            "java.base/java.util=ALL-UNNAMED".to_string(),
            "--add-opens".to_string(),
            "java.base/java.lang=ALL-UNNAMED".to_string(),
        ];
  3. Texhnolyze47 commented on May 5, 2026

    @Texhnolyze47

    Environment
    Zed: v1.0.1
    Platform: cachyos
    Java: 26.0.1
    In my case, it seems to be one of the child processes, but my project is built with Spring Boot

    Image Image
  4. playdohface commented on May 5, 2026

    @playdohface
    Collaborator

    @dpkass @Texhnolyze47 would any of you be able to share a specific project where you run into this issue? We will probably have to do some triaging to figure out what exactly is going on here, and the easier we can reproduce the better

  5. Texhnolyze47 commented on May 5, 2026

    @Texhnolyze47

    This is the repo where i ran into the issue:
    https://github.com/Texhnolyze47/api-jwt-refresh-token

  6. dpkass commented on May 5, 2026

    @dpkass
    Author

    sadly, in my case its not in my hands. i can't give out the code.

    i am happy to run any tests i can.

    also it's fairly inconsistent in my case. sometimes it explodes and sometimes its fine.
    i'll try to keep an eye on it and watch what exactly causes spikes.

    java-lsp-proxy is also incosistently shown in language servers popover, unlike jdtls.

  7. tartarughina commented on May 10, 2026

    @tartarughina
    Collaborator

    @Texhnolyze47 I pulled the package you shared and, with default settings, JDTLS consumes ~2.5 GB of memory for me as well.

    Setting a max memory value ("max_memory": "2G") brought usage down to ~1.5 GB.

    This is expected behavior: by default, any JVM instance will use up to 1/4 of the system's physical memory when no explicit limit is defined. You can verify this yourself:

    java -XX:+PrintFlagsFinal -version 2>&1 | grep MaxHeapSize

    Given this, I believe the issue was shared between us (the Zed Java extension) and JDTLS itself:

    • On our side: we were not exposing a way for users to control how much RAM JDTLS could use.
    • On JDTLS's side: because it was well within its allowed memory ceiling, it consumed all available heap space without concern for efficiency.

    As of the latest release, both min_memory and max_memory can now be configured, giving users direct control over JDTLS's memory footprint. Refer to the README to see how to set these parameters.


    @dpkass Regarding the inconsistency you raised: you should only ever see "jdtls" in the language servers popover. If you're able to reproduce the issue, please report it to the Zed team directly, as it's likely a problem on their end rather than in the extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions