托管环境日益流行, 作为托管中重要环节的 GC, 对性能有比较大的影响, 所以对 GC 机制的一定了解, 还是有必要的.
原文讨论了他们公司实现 Pauseless GC 的思路, 在 reddit 的讨论中也有一些很精彩的评论, 在此摘抄部分.
rayiner@reddit
"There is no such thing as "pauseless" memory management. All memory management systems have pauses, the real question is what is the distribution, length, and character of the pauses on various allocation loans?
malloc() has relatively long pauses on allocation and symmetric pauses on frees. However, generally the pauses are of predictable length (though by no means bounded, at all, because you can hit pathological cases scanning free-lists).
A copying generational GC has a very short pause on allocating objects (however long it takes to bump a pointer) and no pause on freeing objects (the tracer never visits dead objects), but potentially long pauses when objects stay alive between collections.
There are a lot of loads where all the pauses involved in malloc() add up to more than what you'll see with a generational GC. On most functional code where there is a lot of temporary state but very little long-term state, a GC will do very little work copying live data at each collection, while a malloc() implementation will have to muck with an increasingly more fragmented free-list for each malloc()/free(). On the flip side, on imperative code where you have a ton of long-lived state, a GC will do a lot of work copying live objects on each collection, while a malloc() implementation will do nothing if objects are just sitting around."
本文讨论了一种称为无停顿垃圾回收(Pauseless GC)的技术实现,并对其在不同场景下的表现进行了对比分析。通过Reddit上的讨论,我们了解到所有内存管理系统都存在暂停,关键在于暂停的分布、长度及特性。此外,还探讨了复制代际GC与malloc()在分配和释放操作中的差异。
687

被折叠的 条评论
为什么被折叠?



