"Go has garbage collection, only. [...] Day 1 design decision." http://talks.golang.org/2012/splash.slide#51
Can someone tell me why GC was the obvious choice as opposed to say automatic reference counting?
Can someone tell me why GC was the obvious choice as opposed to say automatic reference counting?
But it is a trade-off. Refcounting collectors need to address pointer cycles. And they are also quite slow due to all the refcount bookkeeping going on all the time. But they have the nice property that the lifetime of an object won't linger around in a zombie state. And there are no point in time where the system is in a "collecting" state and cannot give service.
That said, many modern, multi-core malloc() routines contain a lot of ideas from GCs in them. The gap is closing fast.