title: Memory not getting released in WPF Image
body: <p>I am loading and unloading images in <code>Canvas</code>. I used the below code to load the <code>Image</code>.</p>
  
  <p>Before loading my <code>Image</code> the memory consumption is 14.8MB.</p>
  
  <pre><code>Canvas c = new Canvas();
  
  Image im = new Image();
  ImageSource src = new BitmapImage(new Uri(@"E:Capture.png"));
  im.Source = src;
  im.Height = 800;
  im.Width = 800;
  
  c.Children.Add(im);
  homegrid.Children.Add(c); //homegrid is my grid's name
  </code></pre>
  
  <p>The <code>Image</code> displayed correctly and the memory consumption now is 20.8MB. Then I unloaded the <code>Image</code> by the below code:</p>
  
  <pre><code>foreach (UIElement element in homegrid.Children)
  {
      if (element is Canvas)
      {
          Canvas page = element as Canvas;
  
          if (page.Children.Count &gt; 0)
          {
              for (int i = page.Children.Count - 1; i &gt;= 0; i--)
              {
                  if (page.Children[i] is Image)
                      (page.Children[i] as Image).Source = null;
                  page.Children.RemoveAt(i);
              }
          }
  
          page.Children.Clear();
          page = null;
      }
  }
  
  homegrid.Children.RemoveAt(2);
  InvalidateVisual();
  </code></pre>
  
  <p>The <code>Image</code> gets removed after this, but the memory is still 20.8 MB.</p>
  
  <p>Can anyone help me out this?</p>