Skip to content

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

@The-Redhat

Description

@The-Redhat

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

  • I attached an LSP report based on the tool from @mraleph
  • 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.

lsp-report.json

Activity

changed the title [-]Dart process consuming a lot of memory, slow autocomplete[/-] [+]Dart process consuming 4GB of memory, slow autocomplete[/+] on Nov 22, 2024
changed the title [-]Dart process consuming 4GB of memory, slow autocomplete[/-] [+]Dart process consuming 14GB of memory, slow autocomplete[/+] on Nov 22, 2024
mraleph

mraleph commented on Nov 22, 2024

@mraleph
Member

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

mraleph commented on Nov 22, 2024

@mraleph
Member

@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

The-Redhat commented on Nov 22, 2024

@The-Redhat
Author

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

runyaga commented on Nov 22, 2024

@runyaga
added
P1A high priority bug; for example, a single project is unusable or has many test failures
type-performanceIssue relates to performance or code size
on Nov 22, 2024
The-Redhat

The-Redhat commented on Nov 25, 2024

@The-Redhat
Author

We have tested the new dart sdk version 3.7.0 internally, and it seems to work quite well. Is there already an ETA when it will be available in the flutter beta channel?

Currently, it is a bit tricky to use another dart sdk alongside the flutter stable channel. We are fine to switch to the flutter beta channel, but we don't want to switch to master.

If somebody has a good setup on how to use a different dart sdk alongside flutter, please share it.

The-Redhat

The-Redhat commented on Dec 2, 2024

@The-Redhat
Author

@mraleph any update on the timeline?

srawlins

srawlins commented on Dec 2, 2024

@srawlins
Member

No update on the timeline of 3.7.

@mraleph or @scheglov can you point me to the commit that fixed the excessive Declaration objects? I can look into cherry-picking.

added
P3A lower priority bug or feature request
and removed
P1A high priority bug; for example, a single project is unusable or has many test failures
on Dec 2, 2024
srawlins

srawlins commented on Dec 2, 2024

@srawlins
Member

Oof, -6625 +112 diff and -1343 +465 diff, landing ~25 days after the last 3.6.0 dev release. I suspect this would be a difficult and risky cherry-pick.

added
area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.
and removed on Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestanalyzer-stabilityarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.type-performanceIssue relates to performance or code size

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @pq@srawlins@mraleph@scheglov@runyaga

        Issue actions

          Dart process consuming 14GB of memory, slow autocomplete · Issue #59596 · dart-lang/sdk