rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.08k stars 1.57k forks source link

Memory leak #16934

Open pitdicker opened 5 months ago

pitdicker commented 5 months ago

On my system rust-analyzer leaks ca. 100mb per second until (hopefully) killed because of OOM. Using rust 1.77.0 on x86_64-unknown-linux-gnu. Any suggestions on how to diagnose?

rust-analyzer version: rust-analyzer version: 0.3.1885-standalone (b6d1887bc 2024-03-17) rustc version: rustc 1.77.0 (aedd173a2 2024-03-17) repository link: https://github.comchronotope/chrono (not sure if relevant)

pitdicker commented 5 months ago

I can't reproduce it reliably yet, it has happened ca. 8 times in the last two days.

Noratrieb commented 5 months ago

probably a duplicate of #16907

pitdicker commented 5 months ago

That could be it! As always it no longer reproduces after opening an issue, but I'll keep an eye out.

DrewMcArthur commented 5 months ago

i should have maybe put this comment on one of the open issues, but this happens pretty continuously as a result of trying to format-on-save for me with the destream_json library open.

https://github.com/rust-lang/rust-analyzer/issues/16140#issuecomment-2016859383

markmehere commented 1 month ago

It's absolutely huge. Hopefully I'll have the time for a closer look at some point but rust-analyzer regularly hits 28-30 gigabytes on my Mac. Wish I had of cracked open a debugger. For future bug reporters:

  1. VSCode -> Command-Shift-P -> Shell Command: Install 'code' command in PATH
  2. code --inspect-extensions=9222
  3. Use remote debugging from your Chrome browser

Seems like you may need to start debugging from before launching VSCode. I've uninstalled rust-analyzer for the moment.

alekspickle commented 1 month ago

I can reliably reproduce it by opening more than 1 project with rust-analyzer hooked

Completely freezes the system for about 10 min resulting in vscode/nvim crash+ sending SIGKILL to terminal instance as well

Noratrieb commented 1 month ago

this is probably a new issue, the one that this was likely a duplicate of (https://github.com/rust-lang/rust-analyzer/issues/16907) was fixed.