Skip to content

RLS memory usage regression #56980

Description

@alexheretic

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.

Project Linux nightly-2018-12-14 Linux stable 1.31
cargo init --bin 80 MiB 25 MiB
rust-random/rand 500 MiB 45 MiB
rust-lang/regex 1.5 GiB 81 MiB

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 MiB
  • nightly-2018-11-04, nightly-2018-11-05 rls is not available
  • rustup run nightly-2018-11-06 rls --cli -> 1.5 GiB

Eliminating RLS source

To rule out RLS itself, I took current RLS code 173be7729ae9ea41303fbd84f339f76554c9d9af,

plus a small fix for older compilers

diff --git src/build/rustc.rs src/build/rustc.rs
index be3c52c..9ebc925 100644
--- src/build/rustc.rs
+++ src/build/rustc.rs
@@ -301,6 +301,7 @@ impl<'a> CompilerCalls<'a> for RlsRustcCalls {
                 edition: match state.session.edition() {
                     RustcEdition::Edition2015 => Edition::Edition2015,
                     RustcEdition::Edition2018 => Edition::Edition2018,
+                    _ => panic!(),
                 },
             };
             let files = fetch_input_files(state.session);


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 MiB
  • rustup run nightly-2018-11-06 cargo run --manifest-path ../rls/Cargo.toml --no-default-features --release -- --cli -> 1.6 GiB

Status

Tests use regex d4b9419 on Arch Linux

2019-03-10

Release Idle memory usage
1.31.1 62 MB
1.32.0 1.6 GB
1.33.0 800 MB

Update 2019-07-04

Release Idle memory usage
1.34.2 740 MB
1.35.0 1.3 GB
1.36.0 1.0 GB

Update 2019-08-16

Release Idle memory usage
1.31.1 83 MB
1.37.0 2.4 GB

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-compilememIssue: Problems and improvements with respect to memory usage during compilation.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions