title: Disposing bitmap in C# application
body: <p>I'm writing a .dll in which I'm using the following method:</p>
  
  <pre><code>public static Bitmap Merge(Bitmap largeBmp, Bitmap smallBmp)
  {
      Bitmap bitmap = new Bitmap(largeBmp.Width + smallBmp.Width, Math.Max(largeBmp.Height, smallBmp.Height));
      using (Graphics g = Graphics.FromImage(bitmap))
      {
          g.DrawImage(largeBmp, 0, 0);
          g.DrawImage(smallBmp, largeBmp.Width, 0);
      }
      return bitmap;
  }
  </code></pre>
  
  <p>I want know if calling this method many times (let's say 10000 times) will cause memory problems. If yes, how can I avoid it? Do I have to call <code>dispose</code> on the <code>bitmap</code> objects? </p>
  
  <p><strong>EDIT</strong>: I'm calling that method in this way inside of a <code>while</code> statement:</p>
  
  <pre><code>writerOut.WriteVideoFrame(Merge(lastFrame, lastColorFrame));
  </code></pre>
  
  <p>How can I dispose the <code>Bitmap</code> that is returned from the <code>Merge</code> method (after I have used it)?</p>