title: How to use Application Verifier to find memory leaks
body: <p>I want to find memory leaks in my application using standard utilities.
  Previously I used my own memory allocator, but other people (yes, you AlienFluid) suggested to use Microsoft's Application Verifier, but I can't seem to get it to report my leaks.
  I have the following simple application:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;conio.h&gt;
  
  class X
     {
     public:
        X::X() : m_value(123) {}
     private:
        int m_value;
     };
  
  void main()
  {
  X *p1 = 0;
  X *p2 = 0;
  X *p3 = 0;
  
  p1 = new X();
  p2 = new X();
  p3 = new X();
  delete p1;
  delete p3;
  }
  </code></pre>
  
  <p>This test clearly contains a memory leak: p2 is new'd but not deleted.</p>
  
  <p>I build the executable using the following command lines:</p>
  
  <pre><code>cl /c /EHsc /Zi /Od /MDd test.cpp
  link /debug test.obj
  </code></pre>
  
  <p>I downloaded Application Verifier (4.0.0665) and enabled all checks.</p>
  
  <p>If I now run my test application I can see a log of it in Application Verifier, but I don't see the memory leak.</p>
  
  <p>Questions:</p>
  
  <ul>
  <li>Why doesn't Application Verifier report a leak?</li>
  <li>Or isn't Application Verifier really intended to find leaks?</li>
  <li>If it isn't which other tools are available to clearly report leaks at the end of the application (i.e. not by taking regular snapshots and comparing them since this is not possible in an application taking 1GB or more), including the call stack of the place of allocation (so not the simple leak reporting at the end of the CRT)</li>
  </ul>
  
  <p>If I don't find a decent utility, I still have to rely on my own memory manager (which does it perfectly).</p>