alibaba / alibaba/flutter_boost

flutter_boost的内存占用是否正常

Open
#933 5 comments 8 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
7.2k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

## Steps to Reproduce
**A small application to reproduce the bug(最小化可复现的demo)**

这里我想测试一下flutter boost在native/flutter页面来回切换时的性能,于是我设计了这么一个场景,在demo里面轮流启动10次两种页面,并dump出内存信息,发现flutter boost的内存占用如下:
![](http://images.vimerzhao.top/flutter_boost.png)

同时,我写了一个demo,也是轮流启动10次,内存占用如下:

![](http://images.vimerzhao.top/official.png)

考虑到我的demo是1.22版本的,于是为了控制变量,我把demo降级到了1.17版本,和boost一样,内存占用如下:

![](http://images.vimerzhao.top/official_1.17.png)

我的问题是**boost的复用似乎让内存占用更大了,尤其是EGL mtrack这块,这样是否正常?**

以下是我测试的核心脚本:
```bash
pname="com.taobao.idlefish.flutterboostexample"
adb shell am start -n $pname/$pname.MainActivity
for i in {1..10} ; do
sleep 3
echo "$i dump native"
adb shell dumpsys meminfo $pname
sleep 1
adb shell input tap 200 1450
sleep 3
echo "$i dump flutter"
adb shell dumpsys meminfo $pname
sleep 1
adb shell input tap 200 950
done

```

此外,我发现thrio这个库在同样的测试中内存增长非常缓慢,比较符合engine复用的预期:
![](http://images.vimerzhao.top/thrio.png)

不知道你们是否有做过这种测试,还是我的测试方法有不合理之处?

**Flutter Boost Version**
**Target Platform:**
**Target OS version/browser:**
**Devices:**

## Logs
add your crash log or something else.

```
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the issue's bash script, the `adb shell dumpsys meminfo` output, and the linked Flutter Boost, official Flutter 1.17, and thrio comparison images. Reproduce the native/Flutter switching loop and determine whether the reported EGL mtrack growth is expected; document the test conditions and conclusion.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart
Domain
mobile, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.