-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RLS memory usage regression #56980
Comments
I can confirm this is caused by #55238, cc @alexcrichton. I tried building rls with jemallocator, but it didn't seem to make a difference. |
Thanks for the digging @alexheretic and @ehuss! I suspect that this is caused by the jemalloc update, perhaps a bug in jemalloc (cc @gnzlbg if you've got knowledge on this). A quick fix for this issue, I believe, would be to link jemallocator to just the rustc binary rather than the librustc_driver crate, I'll send a PR for that. |
This commit moves jemalloc to just the rustc binary rather than the rustc_driver shared library, enusring that it's only used for binaries that opt-in to it like rustc rather than other binaries using librustc_driver like rustdoc/rls/etc. This will hopefully address rust-lang#56980
I'm hoping that #56986 will fix the regression for the RLS |
…Simulacrum rustc: Move jemalloc from rustc_driver to rustc This commit moves jemalloc to just the rustc binary rather than the rustc_driver shared library, enusring that it's only used for binaries that opt-in to it like rustc rather than other binaries using librustc_driver like rustdoc/rls/etc. This will hopefully address rust-lang#56980
With 1.32 coming out I thought I'd retest rls memory usage to provide some more recent numbers.
So this regression has not been addressed and will affect the next stable release. |
@alexheretic I think it is fixed in 1.33. Maybe the fix should have been backported? |
I think it's not fixed in Nightly. OS: Fedora 29 |
I haven't noticed the memory usage of RLS ever coming down on the nightly channel since I reported this. Testing current nightly I still get 756 MiB for regex. Which is a bit better as it's now only ~10x worse. This regression is quite unfortunate, it means users have to manually limit their RLS instances to avoid RAM filling whereas before 5-10 idle RLS processes could be reasonably ignored. |
I'm starting to think all executables (tools) have to do something like rustc in #57287 Nightly rls will use
Stable rls 1.31 uses on first
|
I'm sorry, I only checked on MacOS which seems to be fixed. Indeed, Linux is still broken. Curious since I was expecting them to be the same. Looks like Windows was never affected. |
Windows builds stopped using jemalloc long time ago because of bugs it was causing. I tested RLS built in two ways:
I'm totally puzzled at this point. |
Does anyone have an idea of how we can address this? |
So this appears to be the problem, it should just use the How is the RLS compiled ? Is it dynamically or statically linked against |
@nnethercote this might be some low hanging fruit to fix performance-wise (10x memory consumption due to a linking error). |
@gnzlbg I built RLS with |
Not sure how active this issue is, but working on 1.33.0-nightly (bf669d1 2019-01-25) on Linux (Ubuntu 18.04), RLS (via VS Code) is currently using ~1.5 GB of memory, even when I'm doing nothing at all. |
This is still very much an issue. Here are some fresh tests, again running
|
Currently experiencing this on what is a very small crate. I can get 9.5GB of memory usage if I try to work through the slowness for a while. It gets to 2.5 GB almost immediately. |
Pinging @alexcrichton, previous attempts didn't solve RLS issue. Short summary: It affects official Rust builds for Linux and distributions not using jemalloc for builds. Windows seems unaffected. Any clue what could I try next? |
You can see if #59436 fixes it, by building with it applied locally until it lands, but... I doubt it.
If you are sure that there is only one malloc symbol in your binary, and that's the one from jemalloc, then you mentioned above that the allocations for librustc are way too big. You might want to try to debug why. Is rustc requesting that much memory? |
It's still bad.
|
I'm using 1.55.0 nightly and RLS still eventually gobbles up 6 GiB of memory on my project (albeit during active editing rather than idle conditions). Hope this gets fixed. |
@bluebear94 rust-analyzer is essentially the primary Rust sdk library now (and it's much better). You should probably switch if your editor supports it. |
Closing this issue as RLS is deprecated. |
I've noticed RLS is consuming much more memory with all projects on Linux. My tests indicate this is not an issue with RLS itself.
Downstream: rust-lang/rls#1188
Reproduction
Originally I produced the regression with stable vs nightly.
Memory usage running
rls --cli
. Reading taken after running once until built, quitting and re-running again and waiting for build complete.Release introduction
Trying to narrow down the regression I found it appeared in
nightly-2018-11-06
by bisecting nightly channel rls releases.Testing as above with the regex crate:
rustup run nightly-2018-11-03 rls --cli
-> 100 MiBrustup run nightly-2018-11-06 rls --cli
-> 1.5 GiBEliminating RLS source
To rule out RLS itself, I took current RLS code
173be7729ae9ea41303fbd84f339f76554c9d9af
,plus a small fix for older compilers
Again testing as above with the regex crate (plus the RLS source checked out next door):
rustup run nightly-2018-11-03 cargo run --manifest-path ../rls/Cargo.toml --no-default-features --release -- --cli
-> 100 MiBrustup run nightly-2018-11-06 cargo run --manifest-path ../rls/Cargo.toml --no-default-features --release -- --cli
-> 1.6 GiBStatus
Tests use regex
d4b9419
on Arch Linux2019-03-10
Update 2019-07-04
Update 2019-08-16
The text was updated successfully, but these errors were encountered: