当前位置:网站首页>A scheme to improve the memory utilization of flutter
A scheme to improve the memory utilization of flutter
2020-11-08 10:29:00 【InfoQ】
background
The image scheme we use is a self-developed external texture scheme :
- Android Side create SurfaceTexture, adopt FlutterJNI Sign up to Flutter engine in , Finally back to texture id to Flutter application layer , Application layer usage Texture Widget and textue id To show the texture of the image .
- Texture data is in Android Side , adopt OpenGL Write the image texture to SurfaceTexture, And then through Flutter engine Shared memory in , Passing texture data to the application layer , Finally handed over to Skia Rendering .
The problem is : Flutter The texture data of the application layer is not cached , Every time you need to put Bitmap Data is rendered into textures , Give it back Flutter Application layer usage .Native Image loading will cache memory ,Flutter The image library provided by itself also has a cache , this 2 The caches are isolated from each other , It takes up a lot of memory . and Flutter The image cache is basically a local resource map , And we Flutter Most of the pages are actually external texture images downloaded from the Internet , This leads to low utilization of cache resources .
analysis
For the above 3 A question , Let's get rid of technology and implement , Suppose you want to solve this 3 A question , What is the ideal solution :
- Texture has no cache , Then we add a texture memory cache in the application layer to solve the problem .
- When the upper application layer has already cached the texture , that Native On the side Bitmap Memory cache can also be removed , Keep only the disk cache of image resources .
- Whole App Memory cache , Only texture caching ,Flutter Of ImageCache cache , In order to avoid the waste of memory resources , Will this 2 One cache is combined into one
Link to the original text :【https://www.infoq.cn/article/4t9HrwJFvRh41X2328Gy】. Without the permission of the author , Prohibited reproduced .
版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
边栏推荐
- 将“光头”识别为“足球”,AI 摄像头如何犯的错?
- Rust: command line parameter and environment variable operation
- How did Julia become popular?
- 软件测试培训班出来好找工作么
- Oops, the system is under attack again
- Web novice problem of attacking and defending the world
- 一个方案提升Flutter内存利用率
- 解决RabbitMQ消息丢失与重复消费问题
- 2 days, using 4 hours after work to develop a test tool
- 洞察——风格注意力网络(SANet)在任意风格迁移中的应用
猜你喜欢
YGC问题排查,又让我涨姿势了!
Web novice problem of attacking and defending the world
解决Safari浏览器下载文件文件名称乱码的问题
不多不少,大学里必做的五件事(从我的大一说起)
Flink的sink实战之一:初探
虚拟机中安装 macOS 11 big sur
What is the difference between vivoy73s and vivoy70s
你搞不懂与别人的差距,永远成不了架构师!月薪15K和月薪65K,你差在那了?
More than 50 object detection datasets from different industries
ASP.NET MVC下基于异常处理的完整解决方案
随机推荐
C++在C的基础上改进了哪些细节
python_scrapy_房天下
PCIe 枚举过程
Analysis of ArrayList source code
不多不少,大学里必做的五件事(从我的大一说起)
Deeplight Technology Bluetooth protocol SRRC certification services
Game optimization performance (11) - Zhihu
5g/4g工业无线路由器
Iqkeyboardmanager source code to see
Test requirements for MIC certification of Bluetooth 2.4G products in Japan
PX4添加新的应用
Dogs can also operate drones! You're right, but it's actually an autonomous drone - you know
渤海银行百万级罚单不断:李伏安却称治理完善,增速呈下滑趋势
Cloud alibabab notes come out, the whole network detailed explanation only this one hand is slow
Python3.9的7个特性
SQL Server 2008R2 18456 error resolution
413【毕设课设】基于51单片机无线zigbee无线智能家居光照温湿度传输监测系统
i5 1135g7和i5 1035g1参数对比区别大吗? 哪个好
Astra: Apache Cassandra的未来是云原生
Unparseable date: 'mon Aug 15 11:24:39 CST 2016', time format conversion exception