title: __try not catching exception on HeapFree
body: <p>I'm trying to catch a <code>HeapFree</code> exception..</p>
  
  <p>On MSDN it says <code>HeapFree</code> has undefined behavior when trying to free an already freed pointer.
  Well, I tried that on VS2010, and it "throwed" a breakpoint (windows has triggered a breakpoint), then an exception (a heap has been corrupted)</p>
  
  <p>Im trying to catch that with _<em>try/</em>_except but it's not being triggered:</p>
  
  <pre><code>__try{      
    HeapFree(hHeap, 0, pMem);
  }
  
  __except(EXCEPTION_EXECUTE_HANDLER){
     DWORD exception = GetExceptionCode();
  }
  </code></pre>
  
  <p>How can I catch this exception? normal try/catch also doesn't work. I don't know what's going on; I'm more interested in the explanation than in the solution itself.</p>