title: MFC - Correct place and order of object deletion
body: <p>I have a <code>CDialog</code>, containing members such as</p>
  
  <pre><code>CButton *p1;
  CEdit *p2;
  </code></pre>
  
  <p>.....</p>
  
  <p>All of which call <code>::create</code> at <code>OnInitDialog</code>.</p>
  
  <p>It seems like I don't free memory correctly after I am done with the dialog.</p>
  
  <p>Can anyone refer me to a good document/link about best practice to free up memory for MFC Windows Objects?</p>