rust_analyzer consuming excessive RAM - looking for solutions

66 points Sad-File4952 33 comments

Working on my machine with 24GB RAM and running into serious memory issues. I use multiple Neovim sessions for different Rust projects, often jumping between various git branches in separate instances. Each session seems to spawn its own rust_analyzer process, which gradually consumes more and more memory until my system becomes unresponsable.

Currently I have couple browser tabs open plus maybe 4-5 Neovim instances active at same time. The memory usage keeps climbing until everything starts using swap heavily and performance becomes terrible. I already tried adjusting swap settings but wondering if there are better approaches.

Has anyone found effective ways to control rust_analyzer memory usage? Maybe some configuration options or different setup that prevents this memory explosion? Would appreciate any suggestions since this is really disrupting my workflow.