作者ghoster7 (Dope)
看板Soft_Job
标题[讨论] Flutter载入图片後Memory释放的问题
时间Wed Feb 3 18:49:00 2021
最近尝试碰Flutter来写App,写完後给QA测试发现用久了会很Lag。
然後用AS内建的Profiler查看是什麽原因导致Lag,结果应该是该功能里的图片载入後
记忆体会飙升,且在离开後记忆体不会马上释放。大概要过个3、4分钟後才慢慢降下
来。在古狗半天解让记忆体降下来的方法後都没找到好的解法
想说请问这边的前辈有没有什麽办法可以解
环境:
https://imgur.com/a/LXCNN6j
使用情况:
再载入图片前正常使用APP,记忆体使用量约 200M,在载入两张图片後标到450M左右。
(一张图约1MB左右,JPG,以压缩过。),在载入其他的照片会持续+记忆体的使用量,最
高到1G左右。
Profiler:
https://imgur.com/a/YB6DDBu
--
"One man looks at a dying bird and thinks there's nothin' but unanswered pain.
But death got the final word. It's laughing at him."
"Another man sees the same bird,
feels the glory. Feeling something smiling through him."
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 118.163.212.124 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Soft_Job/M.1612349346.A.0F0.html
1F:→ ripple0129: 建议你贴放图片的程式码这个能看的出原因的通灵真的要 02/03 21:48
2F:→ ripple0129: 够强 02/03 21:48
3F:嘘 accessdenied: 1 MB jpg 压缩什麽的,只对储存空间有意义..载入耗 02/03 22:16
4F:→ accessdenied: 用的记忆体是根据展开成 width x height x bits 的 02/03 22:16
5F:→ accessdenied: 大小计算,懂? 02/03 22:16
6F:→ htury: 用久了Lag,你确定是载图吗?猜是memory leak,查看看哪些 02/04 08:37
7F:→ htury: 被keep住 02/04 08:37