title: Should RAII cause memory leaks?
body: <pre><code>#define _CRTDBG_MAP_ALLOC
  #include &lt;stdlib.h&gt;
  #include &lt;crtdbg.h&gt;
  
  struct A
  {
      A(char* p)
          : p(p)
      {}
  
      ~A()
      {   
          delete this-&gt;p;
      }
  
      char* p;
  };
  
  int main()
  {
      A a(new char);
      _CrtDumpMemoryLeaks();
  }
  </code></pre>
  
  <p>After running in debugging mode, the output window of Visual Studio 2012 shows:</p>
  
  <pre><code>Detected memory leaks!
  Dumping objects -&gt;
  {142} normal block at 0x007395A8, 1 bytes long.
   Data: &lt; &gt; CD 
  Object dump complete.
  </code></pre>
  
  <p>What's the cause?</p>