英文:
SimMetalHost process for iOS simulator using 40GB of RAM on Mac
问题
我一直在使用我的8GB M1 MacBook Air制作Flutter移动应用程序。我在iPhone 14 Pro Max iOS模拟器上进行测试。最近我收到一个弹出窗口,显示我的系统已经耗尽了应用程序内存。我打开的所有应用似乎都没有占用那么多内存。我在活动监视器中检查后发现,进程SimMetalHost(iPhone 14 Pro Max: default)
占用了大约40GB的内存。我停止了该进程,也停止了模拟器。这暂时解决了错误,但问题大约在一小时后重新出现。
英文:
I've been using my 8GB M1 Macbook Air to make a Flutter mobile app. I'm testing it on an iPhone 14 Pro Max iOS simulator. I recently got a popup saying my system was out of application memory. None of the apps I had open seemed to be taking up that much RAM. I checked in activity monitor and found the process SimMetalHost (iPhone 14 Pro Max: default)
was using around 40GB of RAM. I stopped the process which stopped the simulator. That fixes the error temporarily, but then the issue comes back after an hour or so.
答案1
得分: 6
请检查Flutter仓库中的问题编号127482(截至2023年5月24日)。
尝试将Flutter降级到早于3.10的版本,并查看行为是否仍然存在。
英文:
Please check issue number 127482 at Flutter repository (from May 24, 2023).
Try to downgrade Flutter to an older version (before 3.10) and see if the behavior persists.
答案2
得分: 1
以下可能是内存消耗过多的可能原因:
- 过度使用小部件(每个小部件单独消耗内存)
- 复杂的小部件(带有动画的小部件)
- 第三方插件(可能某些第三方插件编写不佳)
- 错误的渲染模式(Flutter有两种渲染模式,软件渲染速度较慢,但内存使用较少,硬件渲染速度更快,但内存使用更多)
对于simmetalhost:
- 减小图像大小
- 减少动画使用
- 减少文本使用
- 使用更轻的主题
奖励:关闭未使用的内容以减少交换风险。
英文:
Following can be the possible reasons for the too much memory consumption:
- Using widgets excessively (Each widget seperately consumes memory)
- Complex widgets (widgets with animations)
- Third-party plugins (possibly some third party plugins xan be poorly written)
- Wrong rendering mode (Flutter has two rendering modes, software and hardware. Software rendering is slower, but it uses less memory. Hardware rendering is faster, but it uses more memory.)
For simmetalhost:
- Reduce the size of your images
- Use less animations
- Use less text
- Use a lighter theme
Bonus: Close unused to reduce the risk of swap.
答案3
得分: 0
在模拟器中使用 flutter run --no-enable-impeller
运行您的应用程序,以修复内存泄漏问题。这是GitHub上的一个已公开问题,您可以在此处找到。
英文:
Run your app in Simulator using flutter run --no-enable-impeller
to fix the memory leaks. This is a open issue on GitHub you can find here.
答案4
得分: -1
我在切换到主分支时遇到了这个问题。切换回稳定分支解决了这个问题。
英文:
I had this issue when i switched to the master branch. Switching back to the stable branch fixed the issue.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论