Isn it much cheaper to use reference counts rather than garbage collection?
No, updating reference counts is quite expensive, and they have a couple of problems: • They can’t cope with cycles; that is, sets of objects that are referred to only by objects in that set, but that don’t have a zero reference count. • Reference counting gets more expensive if you have to allow for the count overflowing. There are many systems that use reference counts, and avoid the problems described above by using a conventional garbage collector to complement it. This is usually done for real-time benefits. Unfortunately, experience shows that this is generally less efficient than implementing a proper real-time garbage collector, except in the case where most reference counts are one. Related terms: reference counting Relevant publications: • David S. Wise. 1993. Stop-and-copy and one-bit reference counting.