I’ve been thinking about Garbage Collection (GC) lately. Specifically, I’ve been thinking about reference counting. Before I start, lets review the state of the world.
GC systems are still a sticking point between different camps of programmers.
There is the performance camp, and they never see GC as a viable option. (OS, Embedded, and Game Engine writers)
Then there is the, ‘why must we suffer these inessential’ details group. (Everybody else).
Both groups have their individuals that don’t quite understand … that they really don’t understand. For example, there are probably quite a few C++ guys who don’t know how bad their allocators perform, or are using them incorrectly, or for a difference of a few microseconds. There are probably also the pro GC people who think that something is acceptable, when a normal user would be quick to unintall.
Right now, the GC group is winning. When you look at java, perl, python, C#, php, Visual Basic, etc, those languages are growing much faster than others. Even the C++ camp is moving to a reference counted GC world.
So, my question is this. Is there a middle ground? Can we do better? What if I want to mix languages… what if they all have to play together? If that is a design goal, then we should start thinking about this differently.
So far, from my experiences, the common solution to the problem has been the use of reference counting systems. I know that reference counting systems have their issues (the inability to free circular references), but at a certain granularity, they work really well. They are used all over the place in OS’s and component systems. Many advanced GC researchers can prove that the overall cost of a reference counting system is higher or not as good, but they cannot argue with their interactive performance.
Maybe it is time again to look at code sharing between different languages, and see if there is a way to build systems that can make both camps happy. Maybe it is time to look at computer architecture again and see if we can’t throw some hardware at the problem.