-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Closed
Copy link
Description
Steps to Reproduce
- Execute
flutter runon the code sample - Tap 'Show Image List', and move app to background instantly, before the images finish loading
Expected results:
No memory leaks
Actual results:
The memory used by this app will grow in background, and never be freed even after we bring it back to foreground, close the image list page, or call ImageCache.clear programatically.
It may be related to #102140, but not same.
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Builder(builder: (context) {
return Center(
child: TextButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const ImageListPage()),
);
},
child: const Text('Show Image List'),
),
);
}),
);
}
}
class ImageListPage extends StatelessWidget {
const ImageListPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Image List'),
),
body: GridView.builder(
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
itemBuilder: (context, index) {
return Image.network(
'https://picsum.photos/id/$index/2000/2000',
loadingBuilder: (context, child, loadingProgress) {
if (loadingProgress == null) {
return child;
}
return const Center(child: CircularProgressIndicator());
},
);
},
),
);
}
}Logs
[✓] Flutter (Channel stable, 3.0.1, on macOS 12.4 21F79 darwin-arm, locale zh-Hans-CN)
• Flutter version 3.0.1 at /Users/yeatse/Developer/Repo/flutter/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision fb57da5f94 (5 days ago), 2022-05-19 15:50:29 -0700
• Engine revision caaafc5604
• Dart version 2.17.1
• DevTools version 2.12.2
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
[✓] VS Code (version 1.67.2)
• VS Code at /Users/yeatse/Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.40.0
[!] Proxy Configuration
• HTTP_PROXY is set
• NO_PROXY is 127.0.0.1,localhost
• NO_PROXY contains localhost
• NO_PROXY contains 127.0.0.1
! NO_PROXY does not contain ::1
[✓] Connected device (1 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.4 21F79 darwin-arm
! Error: CC’s iPhone 12 Pro is not connected. Xcode will continue when CC’s iPhone 12 Pro is connected. (code -13)
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 4 categories.
Metadata
Metadata
Assignees
Labels
No labels