title: Is it OK to run GC.Collect in a background thread?
body: <p>Following <a href="https://stackoverflow.com/a/5384037/107625">this SO answer</a>, I'm doing:</p>
  
  <pre><code>ThreadPool.QueueUserWorkItem(
      delegate
      {
          GC.Collect();
          GC.WaitForPendingFinalizers();
          GC.Collect();
      });
  </code></pre>
  
  <p>My goal is to do a garbage collection run after I close a large WinForms form with lots of images/PictureBox controls to ensure I have no images in memory anymore. (I do believe I follow <a href="https://stackoverflow.com/a/478177/107625">the instructions of Jon Skeet</a>).</p>
  
  <p>I'm doing it in a background thread in order to try to have my UI responsive.</p>
  
  <p><strong>My question:</strong></p>
  
  <p>Does it bring me any benefits to do the garbage collection in a background thread? Or does it actually make my application slower/hang longer?</p>