rust-lang / rust-lang/rust-analyzer

Out of memory when trying to analyze big auto-generated files

Open
#13,807 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

C-support
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Follow-up of #13788.

Rust analyzer no longer panics when trying to parse big files. However, now my system OOMs (16 GB of RAM) while trying to analyze the generated files.

EDIT:
This only happens after triggering a cargo check on save. I tested cargo check alone and it only consumes 3+GB of RAM, so the problem seems to be R-A.

To reproduce

git clone https://github.com/jedel1043/ra-bug.git && cd ra-bug

Depending on the base memory consumption, the used memory should increase by 8+ GB after opening the project and triggering a cargo check. For some high-end systems this should not be a problem, but the standalone repo bumps the used memory to approx. 15.8 GB on my system, and trying to use the crate in a mid-sized workspace project directly OOMs.

rust-analyzer version: 0.4.1326-standalone

rustc version: rustc 1.66.0 (69f9c33d7 2022-12-12)

cc @Manishearth

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked ra-bug repository and reproduce the report by opening the project and triggering cargo check on save; compare this with running cargo check alone. Use the reported rust-analyzer 0.4.1326-standalone and rustc 1.66.0 versions as context. Done means analyzing the generated files no longer causes the reported multi-gigabyte memory increase or out-of-memory failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.