Skip to content

Ram usage grows incredibly fast with minimal changes #20949

@Calcoph

Description

@Calcoph

rust-analyzer version: rust-analyzer version: 1.93.0-nightly (292be5c7 2025-10-29)

rustc version: rustc 1.93.0-nightly (292be5c7c 2025-10-29)

editor or extension: VSCode rust-analyzer

relevant settings: "rust-analyzer.server.path": "C:\\Users\\Calcoph\\.cargo\\bin\\rust-analyzer"

So, to establish a baseline, I have a project with the following Cargo.toml:

[package]
name = "test_repo"
version = "0.1.0"
edition = "2024"

[dependencies]
#wgpu = "24.0.1"

Note that wgpu is commennted out, that's for later.

There is a single source file inside ./src/

main.rs:

fn main() {

}

Windows task manager shows rust-analyzer.exe at 360MB

I will be modifying the project. After each modification I hit "restart server" on vscode and wait until RAM usage settles.

Once I uncomment the wgpu dependency, the RAM usage is at 1,022MB. For context, wgpu is a pretty big crate.

Now main.rs contains the following:

fn main() {

}

impl A for B {

}

The RAM usage is already at 1,169MB

New main.rs content:

fn main() {

}

impl A for B {
    fn f(&mut self) {

    }
}

Now it is at 1,434MB

fn main() {

}

impl A for B {
    fn f(&mut self) {
        match g {
            C::D(e) => self.resized(f),
        }
    }
}

Now at 1,442MB. Until here the jumps weren't big, but quite bigger than what I expected (except the wgpu introduction)

Here is the one that worries me the most:

fn main() {

}

impl A for B {
    fn f(&mut self) {
        match g {
            C::D(e) => self.resized(e),
        }
    }
}

It is now at 5.775MB That is a 4GB jump by renaming a parameter from f to e.

Of course this final function is a very reduced example of the project I'm working on, which now uses so much RAM that I can no longer run RA for the project, and I'm on a 32GB machine.

EDIT:

For completeness sake, I forgot to add the case where main.rs contains the final contents but there is now wgpu dependency. In that case, the RAM usage is much lower at 616. The wgpu dependency is important for this ticket, even though at no point has wgpu been referenced in main.rs

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-perfperformance issuesC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions