title: To GC or Not To GC
body: <p>I've recently seen two really nice and educating languages talks:</p>
  
  <p><a href="http://channel9.msdn.com/posts/C-and-Beyond-2011-Herb-Sutter-Why-C" rel="noreferrer">This first one</a> by Herb Sutter, presents all the nice and cool features of C++0x, why C++'s future seems brighter than ever, and how M$ is said to be a good guy in this game. The talk revolves around efficiency and how minimizing heap activity very often improves performance.</p>
  
  <p><a href="http://www.youtube.com/watch?v=RlVpPstLPEc" rel="noreferrer">This other one</a>, by Andrei Alexandrescu, motivates a <em>transition</em> from C/C++ to his new game-changer <em>D</em>. Most of D's stuff seems really well motivated and designed. One thing, however, surprised me, namely that D pushes for garbage collection and that all classes are created solely <em>by reference</em>. Even more confusing, the book <em>The D Programming Language Ref Manual</em> specifically in the section about <em>Resource Management</em>  states the following, quote:</p>
  
  <p><em>Garbage collection eliminates the tedious, error prone memory allocation tracking code
  necessary in C and C++. This not only means much faster development time and lower
  maintenance costs, but the resulting program frequently runs <strong>faster</strong>!</em></p>
  
  <p>This conflicts with Sutter's constant talk about minimizing heap activity. I strongly respect both Sutter's and Alexandrescou's insights, so I feel a bit confused about these two key questions</p>
  
  <ol>
  <li><p><em>Doesn't creating class instances solely by reference result in a lot of unnecesseary heap activity?</em></p></li>
  <li><p><em>In which cases can we use Garbage Collection without sacrificing run-time performance?</em></p></li>
  </ol>