rust-lang / rust-lang/rust-analyzer
Out of memory when trying to analyze big auto-generated files
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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