Cost to GC of using weak references in C#?

Posted by Scott Bilas on Stack Overflow See other posts from Stack Overflow or by Scott Bilas
Published on 2010-05-14T22:58:51Z Indexed on 2010/05/14 23:04 UTC
Read the original article Hit count: 276

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.

© Stack Overflow or respective owner

Related posts about c#

Related posts about weak-references