Skip to content

Android memory leaks until it is killed by the system #31303

@fly512

Description

@fly512

We tested the latest version, as well as beta version, and found that if any animation on the APP plus a picture, it would lead to a constant increase in memory. The more complex the UI, the faster the memory grows (Native memory).

The simplest version below, with only one picture and one animation

企业微信截图_15556719181553

When APP goes back to the background, Native memory decreases slightly. In the background, the memory will not change, but when it goes back to the front, Native memory will be higher than before.

[√] Flutter (Channel unknown, v1.5.2, on Microsoft Windows [Version 10.0.17134.706], locale zh-CN)
    • Flutter version 1.5.2 at C:\tool\flutter
    • Framework revision efe744a360 (2 days ago), 2019-04-17 10:43:19 -0400
    • Engine revision fdd427241b
    • Dart version 2.2.1 (build 2.2.1-dev.4.2 8e73b3c006)


[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:\Users\xxx\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = C:\Users\xxx\AppData\Local\Android\sdk
    • Java binary at: C:\tool\android-studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[√] Android Studio (version 3.3)
    • Android Studio at C:\tool\android-studio
    • Flutter plugin version 34.0.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[√] IntelliJ IDEA Community Edition (version 2018.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.2.1
    • Flutter plugin version 34.0.1
    • Dart plugin version 182.5215

[√] VS Code, 64-bit edition (version 1.31.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 2.25.1

[√] Connected device (1 available)
    • KNT AL10 • 69DDU16511000544 • android-arm64 • Android 6.0 (API 23)
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';

void main() async {
	runApp(App());
}

class App extends StatefulWidget {
	App() {
		print("new App");
	}
	
	@override
	_AppState createState() => new _AppState();
	
}

class _AppState extends State<App> {
	@override
	void initState() {
		super.initState();
	}
	
	@override
	void dispose() {
		super.dispose();
	}
	
	@override
	Widget build(BuildContext context) {
		print("App Build");
		return new MaterialApp(
			title: "test",
			home: Boot()
		);
	}
}

class Boot extends StatefulWidget {
	Boot({Key key}) : super(key: key);
	
	@override
	BootState createState() => new BootState();
}

class BootState extends State<Boot> {
	@override
	void initState() {
		super.initState();
	}
	
	@override
	void dispose() {
		super.dispose();
	}
	
	@override
	Widget build(BuildContext context) {
		List<Widget> res = [];
		for(int i = 0; i < 200; i++){
			res.add(
				new Container(
					height: 20.0,
					decoration: new BoxDecoration(
						border: new Border(
							bottom: new BorderSide(
								color: Theme.of(context).dividerColor
							)
						)
					),
					child: new Text(
						i.toString()
					),
				)
			);
		}
		return new Scaffold(
			body: new Stack(
				children: <Widget>[
					new Positioned(
						child: new Image.network(
							"http://47.254.30.207/background.png",
							fit: BoxFit.cover,
						),
						left: 0.0,
						top: 0.0,
						width: MediaQuery.of(context).size.width,
						height: MediaQuery.of(context).size.height,
					),
					new Positioned(
						left: 0.0,
						top: 0.0,
						width: MediaQuery.of(context).size.width,
						height: MediaQuery.of(context).size.height,
						child: new Center(
							child: new CupertinoActivityIndicator(
								animating: true,
								radius: 50.0,
							),
						),
					)
				],
			),
		);
	}
}

Metadata

Metadata

Assignees

Labels

c: crashStack traces logged to the consolec: performanceRelates to speed or footprint issues (see "perf:" labels)customer: crowdAffects or could affect many people, though not necessarily a specific customer.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions