- Notifications
You must be signed in to change notification settings - Fork29.7k
Description
Greetings,
A few weeks back I upgraded from 2.3.0-17.0.pre.227 master to 2.3.0-17.0.pre.630 master and noticed a Flutter Web debug memory leak that would exceed 10GB after a few minutes and then I'd have to stop it and restart. I was busy and downgraded to 2.3.0-24.0.pre Dev channel and the issue went away again.
When I upgraded to 2.4.0-5.0.pre.79 master and now the latest 2.4.0-5.0.pre.203 the issue immediately reappears.
I realized last night that the issue is specifically related to redraws and having a sample app with just the circular progress indicator is enough to leak around 30-50MBytes / second! And the CPU is quite high as well. Chrome says the Java VM is stable around 60MB, the memory leak is in the Dart.exe itself whether called from command line or from Visual Studio.
Sample code:
minimal code sample
import'package:flutter/material.dart';voidmain() {runApp(constMyApp());}classMyAppextendsStatelessWidget {constMyApp({Key? key}):super(key: key);@overrideWidgetbuild(BuildContext context) {returnMaterialApp( title:'Flutter Demo', theme:ThemeData( primarySwatch:Colors.blue, ), home:Scaffold( appBar:AppBar( title:constText('Welcome to Flutter'), ), body:constCenter( child:CircularProgressIndicator(), ), ), ); }}`
Issue seen with:
flutter doctor -v
[√] Flutter (Channel master, 2.4.0-5.0.pre.203, on Microsoft Windows [Version 10.0.17763.2061], locale en-IE) • Flutter version 2.4.0-5.0.pre.203 at C:\Code\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 738ce43d97 (4 hours ago), 2021-07-26 23:40:49 -0700 • Engine revision 717d55cdd4 • Dart version 2.14.0 (build 2.14.0-354.0.dev)[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\Omega\AppData\Local\Android\sdk • Platform android-30, build-tools 30.0.3 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174) • All Android licenses accepted.[√] Chrome - develop for the web • CHROME_EXECUTABLE = C:\Code\FlutterTesting\ChromeCORS.bat[√] Android Studio (version 2020.3) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)[√] VS Code (version 1.58.2) • VS Code at C:\Users\Omega\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.24.0[√] Connected device (2 available) • Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.107 • Edge (web) • edge • web-javascript • Microsoft Edge 91.0.864.70• No issues found!
Issue also seen with:
flutter doctor -v
[√] Flutter (Channel master, 2.4.0-5.0.pre.79, on Microsoft Windows [Version 10.0.17763.2061], locale en-IE) • Flutter version 2.4.0-5.0.pre.79 at C:\Code\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 72ae6e236e (11 days ago), 2021-07-16 13:46:03 -0400 • Engine revision 26b6520a0c • Dart version 2.14.0 (build 2.14.0-321.0.dev)[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\Omega\AppData\Local\Android\sdk • Platform android-30, build-tools 30.0.3 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174) • All Android licenses accepted.[√] Chrome - develop for the web • CHROME_EXECUTABLE = C:\Code\FlutterTesting\ChromeCORS.bat[√] Android Studio (version 4.1.0) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)[√] VS Code (version 1.58.2) • VS Code at C:\Users\Omega\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.24.0[√] Connected device (2 available) • Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.107 • Edge (web) • edge • web-javascript • Microsoft Edge 91.0.864.70**No Memory leak on 2.3.0-24.0.pre**[√] Flutter (Channel dev, 2.3.0-24.0.pre, on Microsoft Windows [Version 10.0.17763.2061], locale en-IE) • Flutter version 2.3.0-24.0.pre at C:\Code\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 2b9537c783 (6 weeks ago), 2021-06-11 22:11:53 -0700 • Engine revision ddbac024d1 • Dart version 2.14.0 (build 2.14.0-188.0.dev)[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\Omega\AppData\Local\Android\sdk • Platform android-30, build-tools 30.0.3 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174) • All Android licenses accepted.[√] Chrome - develop for the web • CHROME_EXECUTABLE = C:\Code\FlutterTesting\ChromeCORS.bat[√] Android Studio (version 4.1.0) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)[√] VS Code (version 1.58.2) • VS Code at C:\Users\Omega\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.24.0[√] Connected device (2 available) • Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.107 • Edge (web) • edge • web-javascript • Microsoft Edge 91.0.864.70