Skip to content

Huge memory leak with dart 2.7.0 #4143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dluksza opened this issue Nov 26, 2019 · 17 comments
Closed

Huge memory leak with dart 2.7.0 #4143

dluksza opened this issue Nov 26, 2019 · 17 comments
Assignees
Milestone

Comments

@dluksza
Copy link

dluksza commented Nov 26, 2019

After upgrading to latest beta channel I've notice that code completion in getting slower over time, to the point it stops working completely. Also it is freezing from time to time. What I've also noticed is that my free memory level dropped to less than 1GB (I'm having 32GB ram in my machine and usually only 10 to 12GB are used).

Restarting dart analysis brings back over 20GB of free memory.

BTW. I do have set dart.server.additional.argument to --enable-completion-model.

flutter doctor -v
[✓] Flutter (Channel beta, v1.11.0, on Linux, locale en_US.UTF-8)
    • Flutter version 1.11.0 at /home/lock/bin/flutter
    • Framework revision 856a90e67c (3 weeks ago), 2019-11-08 18:00:01 -0800
    • Engine revision af04338413
    • Dart version 2.7.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /home/lock/Android/Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = /home/lock/Android/Sdk
    • Java binary at: /home/lock/bin/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Android Studio (version 3.5)
    • Android Studio at /home/lock/bin/android-studio
    • Flutter plugin version 41.1.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

• No issues found!
@georgeherby
Copy link

I am having the exact same thing. I was wondering by it was running so slow then realised I was up to 20gb. I restarted Intellij and it was back to normal but less than 30 minutes of running we are back to 9gb. I was not having this until I updated the most recent beta

Flutter 1.11.0 • channel beta • https://github.com/flutter/flutter.git
Framework • revision 856a90e67c (3 weeks ago) • 2019-11-08 18:00:01 -0800
Engine • revision af04338413
Tools • Dart 2.7.0

The beta before did not have this

@devoncarew
Copy link
Member

@dluksza, @georgeherby, thanks for the reports. It sounds like you're both on the current Flutter beta version (Channel beta, v1.11.0), and didn't see the issue on the last beta?

I do have set dart.server.additional.argument to --enable-completion-model.

@dluksza, can you try disabling this option add see if the issue still reproduces? @georgeherby, can confirm whether you have this option enabled?

We'll likely need more info - analysis server logs, profiling info - to diagnose the memory consumption issues. Things will be a little slow around here as many people are OOO for the next few days.

@stereotype441 - can you follow up to get information to help diagnose the memory leak? We are seeing multiple reports of this; it's likely a recent (~flutter beta) regression.

@georgeherby
Copy link

So i did have --enable-completion-model enabled i have just disabled it and restarted Intellij and will see what memory consumption is like

@georgeherby
Copy link

So I disabled it and it has not been leaking, unfortunately, IntelliJ also just updated to 2019.3, I will enable the setting again tomorrow, to confirm that the update to IntelliJ didn't help as it also meant Dart and Flutter plugins updated for 2019.3

@dluksza
Copy link
Author

dluksza commented Nov 29, 2019

I can confirm that removing --enable-completion-model did stop the leak.

@devoncarew
Copy link
Member

@lambdabaa @bwilkerson - it looks like there's a significant memory leak with the ML completion code

@lambdabaa
Copy link

Hi @dluksza and @georgeherby. Could you all share a bit more about your environment / development setup and the project you were working on? Alternatively if you can follow these instructions https://github.com/JetBrains/intellij-plugins/tree/master/Dart#how-to-open-the-dart-analysis-server-with-observatory-and-dart-devtools to get a memory snapshot from the Dart analysis server, that would be hugely helpful for us in tracking down the underlying issue. Thanks!!

@georgeherby
Copy link

I will be happy to help, at a conference for the next few days so won't get a chance until Monday.

@lambdabaa
Copy link

Thanks @georgeherby! Let us know if you run into any difficulties using devtools to collect memory info.

@georgeherby
Copy link

I have updated the most recent beta (hotfix 6) and I have re-enabled ML but I have not been able to replicate this anymore 🤔

@georgeherby
Copy link

georgeherby commented Dec 13, 2019

So it just happened again but I didn't have the settings enabled to do the check the profile. I also did not have ML-enabled so not sure ML is anything to do with it!

Restarting Dart Analysis server resulted in a release of 16gb!

@georgeherby
Copy link

georgeherby commented Dec 16, 2019

@liamappelbe So as I mentioned running with --disable-service-auth-codes --observe=8888 seemed to cause Intellij to stop providing code completion, and indexing.

So i turned it off and like clockwork as soon as i have been using Intellij for a few hours, with an iOS sim IntelliJ is up to 11gb! This is with ML turned off and seems to be something else.

When I open Activity Manager on Mac it breaks down the memory usage to 3gb for Intellij (fine) but Dart 7.73gb. I have attached a process sample from the Mac Activity Manager

Sample of dart process.txt

@georgeherby
Copy link

PS, I may not have followed the instruction properly, as I was unsure how to set Observatory to run for a flutter project, so ended up jsut opening the localhost in Chrome

@georgeherby
Copy link

@lambdabaa So I am still getting this issue on Flutter beta, v1.14.6 :(. I am having to restart the dart analyser everything 30mins or so once it get to about 16gb of memory. I don't have ML or other arguments for Dart in Intellij.

@HugoB-sc
Copy link

HugoB-sc commented Dec 3, 2020

Do you guys found a solution for that ? The problem seems to persist for me, becoming even worst.

15 minutes after launching intellijIdea, the CPU usage (from activity monitor, in macOS) shows 300 percent usage only from intellij, and if I go in details, more than 100 percent from the dart subsection (under intellij Idea).

@semsturgut
Copy link

Same here with Android Studio.

@jwren
Copy link
Member

jwren commented Jan 22, 2024

This functionality was removed from the Dart SDK, closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants