title: Memory is not freed after converting BitmapImage
body: <p>I got a problem with the following c# (test-)code:</p>
  
  <pre><code>    public static void TestBitmap2ByteArray(BitmapImage bitmap)
      {
          JpegBitmapEncoder encoder = new JpegBitmapEncoder();
          MemoryStream memstream = new MemoryStream();
          encoder.Frames.Add(BitmapFrame.Create(bitmap));
          encoder.Save(memstream);
  
          memstream.Close();
      }
  </code></pre>
  
  <p>Each time I call the function, memory is allocated and not freed again. In the real project, the method is called very often and the application runs out of memory.</p>
  
  <p>This is a stripped down version of the code, not returning anything.</p>
  
  <p>I am using Visual Studio2010 and .net 3.5 SP1.</p>
  
  <p>Help is appreciated.
  Thank You.</p>