Sdk: Dart memory leak using Flutter, using 12GB of memory

Created on 15 Oct 2018  Â·  15Comments  Â·  Source: dart-lang/sdk

Is it possible that this is a dublicate of this: https://github.com/dart-lang/sdk/issues/34271. But on the linked issue everything came back to normal without couse. But i installed my complete windows new and all required programs for programming flutter.

unbenannt

I am using 16 GB RAM on my Pc.
This started happening while working without any reason as, far as I no.
VS Code Version is: 1.28.1
This always happens if i start VS Code. VS Code shows analysing in the bottom bar. Something like searching or go to definition don't work.

Link to sourcecode of my current project: https://drive.google.com/file/d/1Tk1GEuLKml0MJvFWP916Zszkeo-dpioe/view?usp=sharing

Flutter 0.9.4 • channel beta • https://github.com/flutter/flutter.git
Framework • revision f37c235c32 (3 weeks ago) • 2018-09-25 17:45:40 -0400
Engine • revision 74625aed32
Tools • Dart 2.1.0-dev.5.0.flutter-a2eb050044

area-analyzer

Most helpful comment

Looks like a dup of #34850 and should be fixed. It might take a bit until it lands in master, then in dev, and later beta

All 15 comments

Just tried also o a complete new computer, this time a Mac, still same problem, but i found out running other flutter projects can be edited by visual studio wihout any memory problems. But we can still don't work, the whole development team is stucking on this. Can you please view this? If you need any further information i will immediatly help you.

Thanks and by the way, great work with flutter. Despite this bug I love to develop with this "library".

Niklas

Looks like https://github.com/flutter/flutter/issues/23155 and seems to hit more people since very recently.

Any idea to fix or workaround, do you really think those two bugs are related? Don't understand me wrong you are as I think way more experienced with flutter.

Something like a warning will not be a problem, but the analyser is not working at all and is using an unpractical amount of memory. But it must be a problem with dart analyser or with my code.

@DanTup is investigating there already.
I don't have much related knowledge, just thought that it might be useful to connect these 2 issues.

One of our developers found the problem, but this is still a bug. He created a new project and copied file by file the files from the old to the new project and looked when the analyser starts to need these excessive amounts of memory. This is the most curious cause for a bug I'v ever had. The cause is follwoing file:

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter_simple_dependency_injection/injector.dart';
import 'package:hapi/services/global_service.dart';
import 'package:scoped_model/scoped_model.dart';

class SearchModel extends Model{
  GlobalService _globalService = Injector.getInjector().get<GlobalService>();

  np //**If we romve this statement, everything seems to happen without any problems**

  Future<Stream<QuerySnapshot>> search(String input) async{
    return _globalService.searchUser(input);
  }
}

Only typing a "np" causes this problem, if you delete the "np" and modify the file in any other way, this problem does not come up.

Very curious, hopefully it helped and the error is fixed soon.

Niklas

I've seen these leaks often recently when working with Flutter. It always seems to be related to Future. It happens (sometimes) when a signature is tagged with Future as a return type; memory consumption spikes to insane amounts (I've seen up to 26GB so far).

Dropping the explicit signature (if you can find the one causing the issue) stops the leak. It's a big problem because I'm practically forced to avoid typing in this scenario.

Looks like a dup of #34850 and should be fixed. It might take a bit until it lands in master, then in dev, and later beta

dart.exe is eating memory even if not in use -> just install Flutter/Dart package to VSCode and voilá -> memory running out!

@mxdpeep please post the output of flutter doctor -v

dart.exe is eating memory even if not in use -> just install Flutter/Dart package to VSCode and voilá -> memory running out!

Can you clarify what you mean by "not in use"? The Dart VM runs the language server that provides functionality like the analysis results shown in the Problems view. If you've installed the plugins and opened a non-Dart project and dart.exe is running, please open a bug at Dart-Code/Dart-Code for me to investigate.

If you have got a Dart project open, it's normal for dart.exe to run because it'll be analyzing your project. Of course, it shouldn't consume all your RAM. If you're not on the latest versions then you might be hitting this bug. Please confirm the version of Flutter or the Dart SDK being used (if a non-Flutter project). You can see these in the status bar of VS Code when you have a .dart file open:

screen shot 2018-11-22 at 2 06 22 pm

If you are on the latest version (Dart v2.1, or the latest beta, dev or master flutter branches) and still see this, then there may still be an issue that needs investigating.

@DanTup I provided you a reproduction of the bug (See issue description), aren't you able to reproduce?

@HerrNiklasRaab This issue was believed to be a dupe of https://github.com/dart-lang/sdk/issues/34850 which was reproduced and fixed in the Dart SDK. Are you still seeing it with the latest versions?

(my last comments were in response to @mxdpeep who appeared to be hitting this issue).

Sorry, missed that, only wanted to help :)

Np! Do let us know if you still see it in latest and we can look again.

Since there's been no response, I'll close this on the assumption it's a dupe of #34850. If anybody believes otherwise, please shout!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xster picture xster  Â·  3Comments

jmesserly picture jmesserly  Â·  3Comments

DartBot picture DartBot  Â·  3Comments

DartBot picture DartBot  Â·  3Comments

Hixie picture Hixie  Â·  3Comments