gpt4 book ai didi

android - 了解垃圾收集器日志 flutter

转载 作者:行者123 更新时间:2023-12-04 17:17:44 25 4
gpt4 key购买 nike

这是我的 flutter 应用程序日志记录的输出:

Explicit concurrent copying GC freed 25188(844KB) AllocSpace objects, 1(20KB) LOS objects, 2% free, 301MB/309MB, paused 348us total 317.699ms

我想了解:

  • “LOS”是什么意思?
  • 什么是“2% 免费”? (垃圾收集器设法释放的空间?或剩余的可用 RAM?)
  • 301MB 和 309MB 代表什么?

当我使用 flutter DevTools 查找内存时,我看到了非常不同的数字:

' here

我添加了“Android”标签,因为我在 Android 10 上运行应用程序,我相信 IOS 的答案是一样的。

提前致谢

最佳答案

此日志消息不是来自 Flutter,而是来自 Android 本身。根据您示例中的日志格式,我猜它是从 ART(Android 运行时)记录的,并且在此处详细描述了日志格式的文档:https://developer.android.com/studio/debug/am-logcat?hl=lt#ARTLogMessages

所以回答你的问题:

What does "LOS" mean ?

大对象空间

What is the "2% free" ? (The space that the garbage collector managed to free ? or the remaining RAM available ?). What represents the 301MB and the 309MB ?

来自链接文档:

Heap stats

Percentage free and (number of live objects)/(total heap size).

因此您当前的堆占用 309 MB 内存,其中包含占用 301 MB 内存的对象。这意味着 2% 的堆空间可以免费使用。

关于android - 了解垃圾收集器日志 flutter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68149816/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com