title: Memory leaks in a Windows Forms application
body: <p>We are developing a big .NET Windows Forms application. We are facing a memory leak/usage problem in that despite we are disposing the forms.</p>
  
  <p>The scenario is like:</p>
  
  <ol>
  <li>Our application is using <strong>60 KB</strong> of memory with a list of records displaying in a grid.</li>
  <li>When the user clicks on a record it opens a form, <code>myform.showDialog</code>, show the details. The memory <strong>jumps</strong> from <strong>60&nbsp;KB to 105&nbsp;MB</strong>.</li>
  <li>Now we close the form <code>myform</code> to get back to grid, and <strong>dispose</strong> that form and <strong>set it to null</strong>. Memory <strong>remains</strong> at <strong>105&nbsp;MB</strong>.</li>
  <li>Now if we again perform step 2, it would jump from <strong>105&nbsp;MB</strong> to <strong>150&nbsp;MB</strong> and so on.</li>
  </ol>
  
  <p>How can we free up the memory when we close <code>myForm</code>?</p>
  
  <p>We have already tried <code>GC.Collect()</code>, etc., but without any result.</p>