Open a-panda-miner opened 4 years ago
Is this with a specific project?
I was following the section 1 of this roguelike tutorial
I notice that whenever I start adding new modules or removing old modules, my CPU goes to 100 and it starts taking all my memory to the point where I just have to restart VsCode.
And I always make sure to close out of VsCode if I leave my pc on as rust-analyzer will, at some point, consume all my RAM.
(This is not with any specific project but with any project I am using)
I'm also affected by this issue. Rust-analyzer gets stuck at 100% CPU and it keeps taking memory. Even if I kill VSCode the process will still be there and eventually my whole system crashes.
This didn't use to happen. It could be that it has been introduced in a recent version. However, I tried downloading older binaries from this repository to no avail.
EDIT: For anyone affected by this issue, I managed to avoid it by downgrading rust-analyzer's VSCode extension to 0.2.266
. I also downloaded the corresponding rust-analyzer binary from this repository and set the executable path manually.
Similarly to OP, I'm using specs for my project, but neither amethyst nor rltk.
EDIT2: I believe there is some reason to suspect the issue is related with sometihng specs
. Rust analyzer used to have trouble inferring some types when iterating collections using spec's Join
trait. That seems to be working now, but it takes a lot of time for rust-analyzer to figure out the types when I mouse hover. My completely uneducated guess it that a new feature has been introduced recently that results in high CPU and memory usage for some codebases, where before rust-analyzer simply wouldn't work.
I'm also affected by this issue. rust-analyzer saturated one thread and consumed over 30GB of memory freezing my system once, second time I caught it early.
I'm running local build from master at 754b4c9
(September 1st) on Linux 5.8.9, using neovim's 0.5.0-dev built-in LSP.
I'm not using specs
in my project, however I am using slotmap
(which is a dependency of specs
).
What are the steps we should take when encountering this next time? What kind of information would help somebody knowledgeable finding the cause of this issue? Should I try updating now or keep running the same version in case I can get it to do it again and somehow extract some useful information?
Seeing the same issue also using specs. Happening fairly frequently, if anyone more knowledgeable takes a look, let me know what information could be useful. Does seem to happen while making changes involving the join trait as mentioned by setzer22
@adrianos42 No need to be hyperbolic here, it doesn't help anybody
I'm starting to notice the same issue using emacs (can't really pinpoint the trigger point though).
I build the server from source using cargo xtask
, if you can tell me what I should install/try to start getting relevant debugging information I can definitely try to help
Learning how to debug Rust programs properly is on my todo list anyway
Can confirm. I'm also using specs
(through amethyst
) and rust-analyzer suddenly begins consuming all of my 16GB RAM and then I have to manually kill rust-analyzer through the terminal.
I really hope this is soon going to be fixed, because it makes rust-analyzer quite unusable.
Having the same problem here.
@LU15W1R7H 2 months later and I'm beginning to feel sad. I like rust analyzer better but if I can't use it I'm forced to go back to RLS, which is unusable in different ways.
@kivo360 I'd recommend you install an older version of the plugin and disable automatic updates. In my personal experience, things are not "stable" enough to name the 1-week release schedule. Something in the analysis still gets broken from time to time for me every other release, so if you need stability, you should pin down a version that works for you and stay there.
As for the issue, I can confirm moving to hecs
from specs
stopped the memory usage spikes in my project. I wouldn't blame specs, which is a perfectly fine library. But it's using some advanced features of the language, and my (un-)educated guess is that this is probably what rust-analyzer is having a hard time interpreting.
I have been encountering random memory usage spikes while using rust-analyzer in either VSCode or coc-rust-analyzer since the updated grammar was introduced (release 2020-08-03).
The memory usage goes rapidly from ~900MB to 10GB+ before crashing my computer, I only managed to take one screenshot:
In my latest crash I was idling for about 20 minutes with the project open on VSCode after trying for several hours to replicate this with no avail, all other crashes happened rapidly after making changes and saving within 1-2 hours of use on CoC.
Libraries used during crashes: amethyst or rltk + specs
Ubuntu 20.04 / Rustc 1.45.2 / rust-analyzer v0.2.273 (VSCode) / [coc.nvim] rust-analyzer7a03f05