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

Dart process consuming 14GB of memory, slow autocomplete #59596

Open The-Redhat opened 6 hours ago

The-Redhat commented 6 hours ago

Description

We have a bigger flutter application with around 100k lines of code. We have almost all lint rules enabled. From time to time the RAM usage of dart rises to 8GB or even 14GB. Killing the dart process brings it down to a few hundred MBs temporary. We couldn't find a clear pattern yet when it rises, but when running the flutter app in the simulator, it definitely happens more often.

Dart SDK version

Dart SDK version: 3.5.3 (stable) (Wed Sep 11 16:22:47 2024 +0000) on "macos_arm64"

Attachments

lsp-report.json

mraleph commented 6 hours ago

I also have an analyzer snapshot, I can send it over privately or upload it to GDrive and share it. I don't want to share it here since it can contain sensitive information.

Please don't share that! It contains the structure of your code and might contain large portions of your source (because strings and possibly token sequences are included into the snapshot). Even if you were willing to share it with us privately we can't look at it directly for this reason.

However I was considering writing a special tool to drop sensitive information from these snapshots to make it possible to share them.

mraleph commented 6 hours ago

@The-Redhat looking at the provided snapshot I can see 1Gb of Declaration objects which was fixed by @scheglov. I wonder if this is possible for you to try master channel?

The-Redhat commented 5 hours ago

I also have an analyzer snapshot, I can send it over privately or upload it to GDrive and share it. I don't want to share it here since it can contain sensitive information.

Please don't share that! It contains the structure of your code and might contain large portions of your source (because strings and possibly token sequences are included into the snapshot). Even if you were willing to share it with us privately we can't look at it directly for this reason.

However I was considering writing a special tool to drop sensitive information from these snapshots to make it possible to share them.

Thanks for letting me know, then I will not share it at all.

@The-Redhat looking at the provided snapshot I can see 1Gb of Declaration objects which was fixed by @scheglov. I wonder if this is possible for you to try master channel?

sure I can try that, I downloaded the latest master dart-sdk. I just need to debug why vs code is not picking it up. Setting "dart.sdkPath": "/Users/{username}/dart-sdk", didn't work so far. It keeps using the version provided by flutter.

Anything else I can provide you to help debug it?

runyaga commented 1 hour ago

https://dartcode.org/faq/#why-cant-dart-code-find-my-dartflutter-sdk

Check your PATH