GC 的 Xamarin 调试输出的含义

Meaning of Xamarin debug output of GC

我 运行 应用程序用 C# Xamarin 为 Android(目标框架 android 8.1)编写,并在调试物理设备时得到这样的日志消息:

09-20 08:53:04.165 D/Mono    (25500): GC_BRIDGE: Complete, was running for 0.14ms
09-20 08:53:04.165 D/Mono    (25500): GC_MINOR: (Nursery full) time 2.53ms, stw 3.56ms promoted 40K major size: 13040K in use: 10738K los size: 40968K in use: 38154K
09-20 08:53:04.617 D/Mono    (25500): GC_BRIDGE waiting for bridge processing to finish
09-20 08:53:04.621 D/Mono    (25500): GC_TAR_BRIDGE bridges 0 objects 0 opaque 0 colors 0 colors-bridged 0 colors-visible 91 xref 1 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.10ms tarjan 0.12ms scc-setup 0.20ms gather-xref 0.01ms xref-setup 0.00ms cleanup 0.00ms

有人知道这方面的文档吗?

例如:GC_MINORtime是什么意思? stw 是什么意思? size 是什么意思?等等

根据the mono documentation

Objects are initially allocated in a nursery using a fast bump-pointer technique. When the nursery is full we start a nursery collection: this is performed with a copying GC.

  • time可能 垃圾收集所花费的时间
  • stw表示"stop the world",表示程序停止执行垃圾收集的时间。
  • SGen中有3个堆,nursery,major heap和large object storage。 size 值表示这些堆的当前大小。
  • promoted表示有多少nursery被提升到major heap

CG 代表垃圾收集器。

CG_MINOR 是 SGen 用于为新对象分配 space 的堆之一,即 SGen 用于 Xamarin 的默认垃圾收集器。

来自 Xamarin 文档:

The Nursery – This is where new small objects are allocated. When the nursery runs out of space, a minor garbage collection will occur. Any live objects will be moved to the major heap.

您可以获得有关 Xamarin 垃圾收集的更多信息here and here