Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Flutter Boost5.0.1 在Flutter3.16.5环境下,使用https://github.com/alibaba/flutter_boost/tree/v5.0.1/example运行,iOS端每新增一个容器,内存增长50-70MB #1985

Open
heijianye opened this issue Mar 9, 2024 · 5 comments

Comments

@heijianye
Copy link

heijianye commented Mar 9, 2024

请描述遇到的问题,以及您所期望的正确的结果

Flutter Boost 5.0.1版本在iOS端打开新容器,内存增长幅度基本维持在50M~70MB左右,从打开第三个容器开始,内存增幅基本维持在70M左右。(Android端没有这个问题,新增flutter容器,内存基本不变)
期望:打开新的容器的时候,内存不要出现大幅度的变化(目前只有iOS有问题)

请说明如何操作会遇到上述问题

具体验证步骤如下:
1.使用boost5.0.1,Flutter的版本为3.16.5,运行https://github.com/alibaba/flutter_boost/tree/v5.0.1/example
sample工程运行模式为release,iPhone12(iOS 14.4.2)。
image
2.启动sample之后,进入首页,内存维持在47.1M,之后点击“Push Flutter Engine”打开第一个flutter容器,内存稳定在102.1M(增长55M);
image
image
3.滑动页面到底部,找到“popUtil demo”入口,内存变为125.8M(增加23.7M),点击打开新容器,此时APP开启了2个flutter容器,内存变为174.7M(增长48.9M)
image
image
4.点击push with container,打开新的容器,此时3个容器,内存变为243.5M(增加68.8M)
image
5.此后在新打开的容器中反复点击push with container打开新容器,依次打开10个Flutter容器,内存变化和增幅依次为310.4M(66.9M),379.3M(68.9M),448.3M(69M),519.3M(71M),586M(66.7M),654.9M(66.9M),723.8M(68.9M)
image
image
image
image
剩下的图,我不贴了,这几张已经足够说明问题。

在下面填入关键复现代码

使用的代码是https://github.com/alibaba/flutter_boost/tree/master/example的sample工程,工程逻辑没有做修改。

复现的平台

iOS

Flutter SDK版本

3.16.5

FlutterBoost版本

5.0.1

是否延迟初始化FlutterBoost

No

解决方案

@heijianye
Copy link
Author

heijianye commented Mar 9, 2024

@heijianye heijianye changed the title [Bug]: Flutter Boost5.0.1 在Flutter3.16.5环境下,使用https://github.com/alibaba/flutter_boost/tree/master/example运行,iOS端每新增一个容器,内存增长50-70MB [Bug]: Flutter Boost5.0.1 在Flutter3.16.5环境下,使用https://github.com/alibaba/flutter_boost/tree/v5.0.1/example运行,iOS端每新增一个容器,内存增长50-70MB Mar 9, 2024
@joechan-cq
Copy link
Collaborator

是否和 #1954 一样的

@iweixiao
Copy link

试试在deinit里,主动释放
WechatIMG187

@xinhc-yuanye
Copy link

@joechan-cq 使用内部容器打开页面 会遇到侧滑返回的问题

@applebest
Copy link

applebest commented May 28, 2024

@joechan-cq 使用内部容器打开页面 会遇到侧滑返回的问题

#1983 (comment)
侧滑的解决问题
开启新的FBFlutterViewContainer:

  1. 开启后内存占用大,FlutterPage 跳FlutterPage 相当于打开两个新的controller
  2. 传参问题,FlutterPage跳FlutterPage不能直接传入对象结构,只能传入基本的数据类型,map、json、字符串、number等,不能传入model

不开启新的FBFlutterViewContainer:

  1. 无法解决侧滑返回问题,NativePage -> FlutterPage-->FlutterPage --> 侧滑 直接回退到NativePage ,不会回到上级的FlutterPage
  2. FlutterPage跳转FlutterPage可以传递model

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants