dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.28k stars 1.58k forks source link

[analyzer] Excessive memory consumption after updating `analysis_options.yaml` several times #57080

Open incendial opened 1 week ago

incendial commented 1 week ago

Steps:

  1. Open analysis_options.yaml
  2. Change it, save and wait for reanalysis
  3. Repeat several times

I think there is something leaking after the project is reanalyzed as I'm observing increased memory consumption that does not go away (and it took around 10 updates to get to 1.4GB for me):

Screenshot 2024-11-13 at 14 24 46

The above result is for when I tried to prepare a repro, and the next one is one of my last observations:

Screenshot 2024-11-13 at 14 20 06

On a restart the project takes ~700 MB. Also note that no other code was changed during the restarts, only the analysis_options.yaml config.

Dart SDK version: 3.5.1 (stable) (Tue Aug 13 21:02:17 2024 +0000) on "macos_arm64"

dart-github-bot commented 1 week ago

Summary: The user reports excessive memory consumption after repeatedly modifying and saving analysis_options.yaml. The memory usage increases significantly with each analysis, suggesting a potential memory leak in the analyzer after updating the configuration file.

DanTup commented 1 week ago

I can reproduce this on Flutter stable by creating a new Flutter counter app and just changing the file repeatedly. However, on Flutter master I cannot repro. It's possible this has been fixed (@scheglov did remove a ton of the old Declarations code that was consuming a lot of memory).

Are you able to test on master/bleeding edge and see if it's resolved for you too?