Keeps addressing (reserving) more RAM than possible leading to crash on Fedora Linux 42 and 4 GB of RAM
rust-analyzer version: latest, with all default features
rustc version: 1.90.0
editor or extension: Helix Editor
relevant settings: latest rust-analyzer
repository link (if public, optional): (eg. rust-analyzer)
code snippet to reproduce:
Open project and work for some time (2:30h>), after which running any command triggers full CPU usage, and oversample RAM
Resolution: prevent rust-analyzer from addressing more RAM than is on the device, and possibly even leaving space for other programs to live. Catchy phrases - runtime speed of Rust come with the cost of development resources burned like calories. Verdict: Rust is not suitable for development on anything low-power, low-spec, eco-friendly, and anything cost efficient. FIX needed.
Being snarky and present "resolutions" that are not worth their words certainly does not motivate us to fix your bugs. Neither does ignoring the instructions in the issue template and not providing a reproduction (even the "latest rust-analyzer" you might think is clear, is not. Is it stable? Prerelease? From GitHub releases? From rustup? There is a reason we provide instructions). rust-analyzer is developed by volunteers, and things like that will not make people want to work on bugs that are frustrating you.
And, for what it's worth, a 4GB or RAM is way too few to develop with Rust. I'd recommend 16GB minimum, and 8GB is the absolute minimum (and is the minimum for a general desktop computer nowadays). While we'd certainly like to improve memory usage, I don't think 4GB will ever be enough.
Over-Size makes calls to reserve much more RAM than is on the device. Maybe later, when I have time upload Helix Logs
On Fri, 17 Oct 2025 at 10:35, Chayim Refael Friedman < @.***> wrote:
ChayimFriedman2 left a comment (rust-lang/rust-analyzer#20857) https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414437212
And, for what it's worth, a 4GB or RAM is way too few to develop with Rust. I'd recommend 16GB minimum, and 8GB is the absolute minimum (and is the minimum for a general desktop computer nowadays). While we'd certainly like to improve memory usage, I don't think 4GB will ever be enough.
— Reply to this email directly, view it on GitHub https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414437212, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3TUS3WNOQNIDCPKA5AHGD3YCS3JAVCNFSM6AAAAACJOPYNQWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIMJUGQZTOMRRGI . You are receiving this because you authored the thread.Message ID: @.***>
What do you expect r-a to do when you don't have enough RAM? Crashing is acceptable in this scenario.
Ok. I misspelled. Rust analyzer is oversize but the error comes from something different. Don’t worry about it. I will give the logs, and you can treat my complaint about size as an opinion.
Bye for now
On Fri, 17 Oct 2025 at 11:02, Chayim Refael Friedman < @.***> wrote:
ChayimFriedman2 left a comment (rust-lang/rust-analyzer#20857) https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414527750
What do you expect r-a to do when you don't have enough RAM? Crashing is acceptable in this scenario.
— Reply to this email directly, view it on GitHub https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414527750, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3TUS4LR3JILFTN4LYDCQD3YCWBXAVCNFSM6AAAAACJOPYNQWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIMJUGUZDONZVGA . You are receiving this because you authored the thread.Message ID: @.***>
2025-10-16T04:26:59.605 helix_lsp::transport [ERROR] rust-analyzer err <- "memory allocation of 38536 bytes failed\n" 2025-10-16T04:27:04.067 helix_lsp::transport [ERROR] rust-analyzer err: <- StreamClosed 2025-10-16T04:29:43.496 helix_lsp::transport [ERROR] rust-analyzer err: <- IO(Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }) 2025-10-16T04:30:35.350 helix_lsp::transport [ERROR] rust-analyzer err <- "memory allocation of 184 bytes failed\n" 2025-10-16T04:31:37.600 helix_lsp::transport [ERROR] rust-analyzer err: <- StreamClosed
On Fri, 17 Oct 2025 at 11:08, museyoucoulduse @.***> wrote:
Ok. I misspelled. Rust analyzer is oversize but the error comes from something different. Don’t worry about it. I will give the logs, and you can treat my complaint about size as an opinion.
Bye for now
On Fri, 17 Oct 2025 at 11:02, Chayim Refael Friedman < @.***> wrote:
ChayimFriedman2 left a comment (rust-lang/rust-analyzer#20857) https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414527750
What do you expect r-a to do when you don't have enough RAM? Crashing is acceptable in this scenario.
— Reply to this email directly, view it on GitHub https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414527750, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3TUS4LR3JILFTN4LYDCQD3YCWBXAVCNFSM6AAAAACJOPYNQWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIMJUGUZDONZVGA . You are receiving this because you authored the thread.Message ID: @.***>
Is there something like minimal tech specs for rust development?
On Fri, 17 Oct 2025 at 11:12, museyoucoulduse @.***> wrote:
2025-10-16T04:26:59.605 helix_lsp::transport [ERROR] rust-analyzer err <- "memory allocation of 38536 bytes failed\n" 2025-10-16T04:27:04.067 helix_lsp::transport [ERROR] rust-analyzer err: <- StreamClosed 2025-10-16T04:29:43.496 helix_lsp::transport [ERROR] rust-analyzer err: <- IO(Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }) 2025-10-16T04:30:35.350 helix_lsp::transport [ERROR] rust-analyzer err <- "memory allocation of 184 bytes failed\n" 2025-10-16T04:31:37.600 helix_lsp::transport [ERROR] rust-analyzer err: <- StreamClosed
On Fri, 17 Oct 2025 at 11:08, museyoucoulduse @.***> wrote:
Ok. I misspelled. Rust analyzer is oversize but the error comes from something different. Don’t worry about it. I will give the logs, and you can treat my complaint about size as an opinion.
Bye for now
On Fri, 17 Oct 2025 at 11:02, Chayim Refael Friedman < @.***> wrote:
ChayimFriedman2 left a comment (rust-lang/rust-analyzer#20857) https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414527750
What do you expect r-a to do when you don't have enough RAM? Crashing is acceptable in this scenario.
— Reply to this email directly, view it on GitHub https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414527750, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3TUS4LR3JILFTN4LYDCQD3YCWBXAVCNFSM6AAAAACJOPYNQWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIMJUGUZDONZVGA . You are receiving this because you authored the thread.Message ID: @.***>
Yeah, looks like the allocations failed due to lack of the physical memory. But we are trying to reduce the memory usages and implement more efficient cache handling and there are already issues that complaining those general memory footprints. But what would you suggest to do for this specific allocation failure?
Bad request, memory too low? On Fri, 17 Oct 2025 at 11:20, Shoyu Vanilla (Flint) < @.***> wrote:
ShoyuVanilla left a comment (rust-lang/rust-analyzer#20857) https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414591073
Yeah, looks like the allocations failed due to lack of the physical memory. But we are trying to reduce the memory usages and implement more efficient cache handling and there are already issues that complaining those general memory footprints. But what would you suggest to do for this specific allocation failure?
— Reply to this email directly, view it on GitHub https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414591073, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3TUS6T4VLF7565W3WXRPL3YCYFVAVCNFSM6AAAAACJOPYNQWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIMJUGU4TCMBXGM . You are receiving this because you authored the thread.Message ID: @.***>
But then everything will fail thereafter. How would it be better than crashing?
Just so I know that I need an upgrade
On Fri, 17 Oct 2025 at 11:25, Shoyu Vanilla (Flint) < @.***> wrote:
ShoyuVanilla left a comment (rust-lang/rust-analyzer#20857) https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414618085
But then everything will fail thereafter. How would it be better than crashing?
— Reply to this email directly, view it on GitHub https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414618085, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3TUS6IQG4UPHGRUG67PDD3YCY2JAVCNFSM6AAAAACJOPYNQWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIMJUGYYTQMBYGU . You are receiving this because you authored the thread.Message ID: @.***>
Yeah, that sounds reasonable. It might be good to improve error messages with allocation failure. But I guess the current error messages are giving the enough information anyway, isn't it?
Even if we could do something, plaguing the codebase with try_reserve() would be a very bad idea. And that wouldn't even help, since there is an overcommit here and the OS kills r-a (otherwise you'd get a nice panic from Rust).
I don't have a minimal spec for a Rust dev machine, but as I said, I recommend 16GB RAM or at the very least 8GB. However the beefier the machine the better, and it'll help for rustc as well.
Rust analyzer just stated that something is wrong with the memory, not what is wrong. But anyway, after 3rd hang-up I already knew that’s the problem. It’s just rust analyzer shouldn’t take so much space in random and let the data queue for completion until there is more space free
On Fri, 17 Oct 2025 at 11:31, Shoyu Vanilla (Flint) < @.***> wrote:
ShoyuVanilla left a comment (rust-lang/rust-analyzer#20857) https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414639485
Yeah, that sounds reasonable. It might be good to improve error messages with allocation failure. But I guess the current error messages are giving the enough information anyway, isn't it?
— Reply to this email directly, view it on GitHub https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414639485, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3TUS3TCYPQECIBYZSQS633YCZOTAVCNFSM6AAAAACJOPYNQWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIMJUGYZTSNBYGU . You are receiving this because you authored the thread.Message ID: @.***>
Rust analyzer just stated that something is wrong with the memory, not what is wrong
The Operating System crashed r-a, not r-a itself, and it also displayed the message, r-a has nothing to do with that. So you can forward your complaint to it.
It’s just rust analyzer shouldn’t take so much space in random and let the data queue for completion until there is more space free
Sorry to be brutal, but: r-a is not going to implement that, period. This will severely complicate the codebase while providing very negligible gains - eventually things will start to fail anyway, and memory is cheap. 4GB is not even a standard for regular desktop machines, as I said, not to mention developer machines, not to mention Rust developer machines.
Queuing data also eats up space. And we can't wait indefinitely until having more free RAM, which is quite improbable, as in general, more codes would be written by the programmer and we have more things to cache for them.
You might feel memory usages being random but that's a complex problem. If you save the file, rust-analyzer (in default configuration) will run cargo check as a subprocess, which uses some amount of memory(not with rust-analyzer but the Rust compiler). While doing so, you might type more codes, which will grow the syntax tree or HIR, will also do more allocation. And for some type hints and completions, it will also try to solve some trait goals, memory growth again. rust-analyzer is somewhat like a live compiler and the usage patterns for it are so complex and giving the general solution to handle those memory spikes are not really doable as Chayim said. If we have some specific reproducible conditions in which the memory usage skyrockets e.g) saving a file in certain project available on web, and then try declaring a new trait inside a file and they are pain points for many people it would worth trying to fix them, but this phenomenon is too vague and I think 4GB is way too low for modern developments with IDE supports (except some very simple languages or small projects with very little dependencies)
My point is that this machine can’t upgrade ram@
On Fri, 17 Oct 2025 at 12:01, Shoyu Vanilla (Flint) < @.***> wrote:
ShoyuVanilla left a comment (rust-lang/rust-analyzer#20857) https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414733803
Queuing data also eats up space. And we can't wait indefinitely until having more free RAM, which is quite improbable, as in general, more codes would be written by the programmer and we have more things to cache for them.
You might feel memory usages being random but that's a complex problem. If you save the file, rust-analyzer (in default configuration) will run cargo check as a subprocess, which uses some amount of memory(not with rust-analyzer but the Rust compiler). While doing so, you might type more codes, which will grow the syntax tree or HIR, will also do more allocation. And for some type hints and completions, it will also try to solve some trait goals, memory growth again. rust-analyzer is somewhat like a live compiler and the usage patterns for it are so complex and giving the general solution to handle those memory spikes are not really doable as Chayim said. If we have some specific reproducible conditions in which the memory usage skyrockets e.g) saving a file in certain project available on web, and then try declaring a new trait inside a file and they are pain points for many people it would worth trying to fix them, but this phenomenon is too vague and I think 4GB is way too low for modern developments with IDE supports (except some simple ones or small projects with very little dependencies)
— Reply to this email directly, view it on GitHub https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414733803, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3TUS4OUJI7WQNY7YUEP2T3YC455AVCNFSM6AAAAACJOPYNQWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIMJUG4ZTGOBQGM . You are receiving this because you authored the thread.Message ID: @.***>
That's too bad, but what's impossible is impossible. To put it in exaggerated terms, we can't play GTA6 with a Playstation 4. You could try allocating more disk space to swap memory or using zram though.
Then buy a new machine. How is that an argument for r-a to do what you describe?
Don’t worry about me. I have just unpacked new Microsoft Surface SE and if Windows could not handle me, then there is Linux. Anyway, it’s good to know that things won’t change, but hey there is always a day after the night
On Fri, 17 Oct 2025 at 12:11, Chayim Refael Friedman < @.***> wrote:
ChayimFriedman2 left a comment (rust-lang/rust-analyzer#20857) https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414787066
Then buy a new machine. How is that an argument for r-a to do what you describe?
— Reply to this email directly, view it on GitHub https://github.com/rust-lang/rust-analyzer/issues/20857#issuecomment-3414787066, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3TUS5CVBVO6IFLTBAJ2Q33YC6G5AVCNFSM6AAAAACJOPYNQWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIMJUG44DOMBWGY . You are receiving this because you authored the thread.Message ID: @.***>