[Disclaimer: the transition to GC happened around the time I started paying attention to GCC, so my knowledge of the pre-GC situation may be inaccurate.]
On 16 May 2005, zouq suggested tentatively: > and now i am thinking that why use garbage collection in gcc, > is it because of its high efficiency? The opposite. Back in days of yore (GCC 1.x and 2.x), GCC managed virtually everything using obstacks, i.e., `stacks of objects' with the usual stack property that you can only add and remove from the end of the stack; you could also free a whole stack at once. For some objects, this made sense: you could build up a bunch of RTL expressions on an obstack with ease, say. But if you wanted to *change* that sequence in ways that added, removed, or reordered elements, things got hairier. (And, of course, that's basically what many of the RTL optimizers do.) The contortions needed to ensure correct ownership of every obstack and to arrange that GCC never needed to add or remove anything in the middle of the obstacks grew rather extreme, and a considerable number of bugs were tripped by freeing an obstack and then referencing some pointer that turned out to point into the middle of it, and so on. Around the long development cycle that led to GCC 3.0, this finally grew overwhelming, and a GC was implemented. Mike Stump (I think it was) and others have collected evidence indicating that the GC was actually responsible for a substantial overall compiler *slowdown*, not because it was slow at collecting garbage, but because related objects now got allocated far apart in memory, so they tended not to share cachelines anymore. As a consequence, some time-critical parts of GCC have actually been moving back towards using obstacks again, and new GC algorithms (the zone allocator in particular) have been worked on which might fix this. But, on balance, GC has probably been a boon, I feel: the code is much more comprehensible now[1], and changing it is not nearly so hair-raising[1]. Some performance loss is worth it if the consequence is a working compiler, I'd say. [1] except for reload -- `End users are just test loads for verifying that the system works, kind of like resistors in an electrical circuit.' - Kaz Kylheku in c.o.l.d.s