Possible Duplicate:
Garbage Collection in C++ — why?
At Going Native 2012 today during Interactive Panel: The Importance of Being Native there was some talk about the future potential of C++ getting a garbage collector. Herb Sutter alluded of it’s potential benefits, specifically for a linked list implementations, but wasn’t specific. My impression was that RAII is a better/more optimal idiom than automatic garbage collection. What benefits could garbage collection have in modern C++?
One advantage of garbage collection is that it lets you batch the object deallocations, and have them happen when convenient from a performance standpoint.
It also is more-or-less immune to programmer mistakes causing memory leaks – you have to be clever to escape a garbage collector, and if you were clever you could manage memory explicitly.