On 5/28/12, Jakub Jelinek <ja...@redhat.com> wrote: > On Fri, May 25, 2012 at 05:43:20PM -0500, Gabriel Dos Reis wrote: > > On May 25, 2012 Lawrence Crowl <cr...@google.com> wrote: > > > Personally, I would rather see if we can take advantage of C++ > > > features to reduce garbage and then use the Boehm collector. > > > There is too much manual management with GTY, and I'd rather > > > the compiler leverage mainstream practice rather than depart > > > from it. > > > > I could not agree more. > > I could not agree less, replacing a nicely precise garbage > collector for a conservative collector? Ugh. I realy want > a deterministic compiler, not one where bugs won't be really > reproduceable because with ASLR the conservative collector collects > or not collects something at some point.
If you want a deterministic compiler, garbage collection is the last thing you want. Explicit memory management deterministically applies every allocation and deallocation. We can get near zero-delay detection of use-after-free. Gcc isn't doing explicit memory management because it is laborious and error-prone in C. In C++, we have more automatic methods for explicit memory managment. While I am not proposing to exploit any of them just yet, if we were to exploit them, gcc would require requires less memory. My main concern is that the precise collector we have in place now requires substantial care to use. It is supported by a tool that does not really understand C, let alone C++. We avoid the problems when annotations are unnecessary. We can do that in one of two ways, either by upgrading GTY to understand more of the language so that it infers the right things from regular code, or by changing the implementation strategy so that the garbage collector does not need type information. I prefer the latter approach, as it makes our experience closer to our customers' experience. The former approach is viable, though. That said, I do not think that we are ready to switch right now. In particular, PCH depends on GTY collection and we don't have a build using conservative collection to evaluate. -- Lawrence Crowl