The advantages of a GC over manual memory management are numerous:
- It makes for cleaner code, there's no need to free something, the gc does this
- No overhead of destructor calls and recursive freeing
- No need to deal with ownership issues
- No heap fragmentation (Boehm doesn't do this, but we're looking into alternative gc's that can)
- Never access an already freed object
- A concurrent copying gc can actually improve allocation time.
Compared to reference counting:
- No need for an atomic inc/dec for every assignment (which has noticable overhead)
- Circular reference aren't a problem
There are probably many more I forgot about.
Not saying there aren't disadvantages to garbage collectors, but having done manual, reference counting garbage collection and tracing garbage collection, my preference goes out to a tracing gc.