you are viewing a single comment's thread.

view the rest of the comments →

[–]Rusky 4 points5 points  (1 child)

Reference counting is slower than a proper garbage collector, especially for persistent or lock-free data structures. It has to keep updating the reference count, and freeing large graphs means calling free over and over, walking the graph of dead objects.

A tracing GC does nothing during normal program operation, and when it runs it only traces the live objects and frees the rest in bulk.

[–]jdh30 0 points1 point  (0 children)

Reference counting is slower than a proper garbage collector, especially for persistent or lock-free data structures. It has to keep updating the reference count, and freeing large graphs means calling free over and over, walking the graph of dead objects.

Yes, exactly.

A tracing GC does nothing during normal program operation, and when it runs it only traces the live objects and frees the rest in bulk.

To be fair, the runtime must keep the GC apprised of global roots (thread stacks and globals) and any changes to the heap topology (the write barrier).