You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In terms of what could be immediately be done, disabling cache priming ("indexing") could help, but that largely defers the memory usage growth: if you're to open/visit the files in question, you'll largely end up with similar memory usage. This does mean the initial LSP requests will take longer, but if you have a large Cargo workspace but rarely touch some crates, this might help.
Out of curiosity, how many lines of code this is project? We've had reports of rust-analyzer's memory usage increasing dramatically on some projects since #18964 landed, but we haven't really determined why some projects seem to have large memory usage spikes while others simply don't.
what I meant is what can you do to fix this issue - which is obviously a bug. Cant you use some memory mapped storage and map a smaller amount of it to RAM than 14GB ? something is wrong with how you store those structs in memory.
something is wrong with how you store those structs in memory.
Well, yes: the trouble is that it's not clear to us what exactly is wrong. Do you mind cloning and building rust-analyzer from source using cargo xtask install --server --jemalloc --dev-rel and run ~/.cargo/bin/rust-analyzer analysis-stats . in the root of your Cargo workspace? Sharing that output would help us better diagnose what is going wrong.
This is particularly bad on my machine because I only have 32gb of ram and rust-analyzer and cargo check truly chug (6+ sec per check), assuming it's paging in memory from swap. It got so bad I just bought an M4 with 128gb of ram, coming in tomorrow :-)
You are free to do so, no one is forcing you to use rust-analyzer, just know that comments like these do not help anyone. They do not fix these issues either, in fact they might have the opposite of effect! So you might want to reconsider these kinds of comments in the future.
Activity
davidbarsky commentedon Apr 9, 2025
In terms of what could be immediately be done, disabling cache priming ("indexing") could help, but that largely defers the memory usage growth: if you're to open/visit the files in question, you'll largely end up with similar memory usage. This does mean the initial LSP requests will take longer, but if you have a large Cargo workspace but rarely touch some crates, this might help.
Out of curiosity, how many lines of code this is project? We've had reports of rust-analyzer's memory usage increasing dramatically on some projects since #18964 landed, but we haven't really determined why some projects seem to have large memory usage spikes while others simply don't.
undenuicap commentedon Apr 9, 2025
what I meant is what can you do to fix this issue - which is obviously a bug. Cant you use some memory mapped storage and map a smaller amount of it to RAM than 14GB ? something is wrong with how you store those structs in memory.
davidbarsky commentedon Apr 9, 2025
Well, yes: the trouble is that it's not clear to us what exactly is wrong. Do you mind cloning and building rust-analyzer from source using
cargo xtask install --server --jemalloc --dev-rel
and run~/.cargo/bin/rust-analyzer analysis-stats .
in the root of your Cargo workspace? Sharing that output would help us better diagnose what is going wrong.Rudxain commentedon Apr 16, 2025
Just for reference: #19402
jkelleyrtp commentedon Apr 17, 2025
Hi - running into similar issues on the http://github.com/dioxusLabs/dioxus/ repo. 17gb of memory usage and seems to endlessly climb.
This is particularly bad on my machine because I only have 32gb of ram and rust-analyzer and cargo check truly chug (6+ sec per check), assuming it's paging in memory from swap. It got so bad I just bought an M4 with 128gb of ram, coming in tomorrow :-)
Lines:
analysis-stats:
With --run-all-ide-things:
my config:
undenuicap commentedon May 16, 2025
this is still happening. sometimes I end up with 3 rust analyser processes running, each occupying 15GB of RAM.
1 rust analyser process occupies double the RAM rust rover uses for the whole IDE.
will have to move back to RustRover. Such a shame.
Veykril commentedon May 16, 2025
You are free to do so, no one is forcing you to use rust-analyzer, just know that comments like these do not help anyone. They do not fix these issues either, in fact they might have the opposite of effect! So you might want to reconsider these kinds of comments in the future.