Cost to GC of using weak references in C#?

In another question, Stephen C says:

A second concern is that there are runtime overheads with using weak references. The obvious costs are those of creating weak references and calling get on them. A less obvious cost is that significant extra work needs to be done each time the GC runs.

So what exactly is the cost to the GC of a weak ref? What extra work does it need to do, and how big of a deal is it? I can make some educated guesses, but am interested in the actual mechanics.


请检查Jeffrey Richter关于.NET中内存管理的文章,它必须澄清一些事情。

链接地址: http://www.djcxy.com/p/978.html

上一篇: NDepend:如何不在依赖图中显示'层'程序集?

下一篇: 在C#中使用弱引用的GC的成本?