[英]Cost to GC of using weak references in C#?
In another question , Stephen C says: 在另一个问题中 , 斯蒂芬C说:
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. 显而易见的成本是创建弱引用和调用get。 A less obvious cost is that significant extra work needs to be done each time the GC runs. 不太明显的成本是每次GC运行时都需要进行大量的额外工作。
So what exactly is the cost to the GC of a weak ref? 那么弱参考的GC成本到底是多少? 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中的内存管理的文章,它必须稍微澄清一下。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.