了解垃圾收集器日志 flutter
Understand the Garbage collector logs flutter
这是我的 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% 免费”? (垃圾收集器设法释放的 space ?或剩余的可用 RAM?)
- 301MB 和 309MB 代表什么?
当我使用 flutter DevTools 寻找内存时,我看到了非常不同的数字:
'
我添加了“Android”标签,因为我是 运行 Android 10 上的应用程序,我相信 IOS 的答案是相同的。
提前致谢
此日志消息不是来自 Flutter,而是 Android 本身。根据您示例中的日志格式,我猜它是从 ART (Android RunTime) 记录的,并且在此处详细描述了日志格式的文档:https://developer.android.com/studio/debug/am-logcat?hl=lt#ARTLogMessages
所以回答你的问题:
What does "LOS" mean ?
大对象Space
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% 的堆。
这是我的 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% 免费”? (垃圾收集器设法释放的 space ?或剩余的可用 RAM?)
- 301MB 和 309MB 代表什么?
当我使用 flutter DevTools 寻找内存时,我看到了非常不同的数字:
'
我添加了“Android”标签,因为我是 运行 Android 10 上的应用程序,我相信 IOS 的答案是相同的。
提前致谢
此日志消息不是来自 Flutter,而是 Android 本身。根据您示例中的日志格式,我猜它是从 ART (Android RunTime) 记录的,并且在此处详细描述了日志格式的文档:https://developer.android.com/studio/debug/am-logcat?hl=lt#ARTLogMessages
所以回答你的问题:
What does "LOS" mean ?
大对象Space
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% 的堆。