title: Memory Leak changing images in Windows Phone 7
body: <p>I have a problem when I change multiple times the image of an Image Container in the Windows Phone 7.5</p>
  
  <p>Here's the faulty code:</p>
  
  <pre><code>public void displayImages() {
      image1.Source = new System.Windows.Media.Imaging.BitmapImage
         (new Uri("BrainImg/axis/" + axis + currentSlice + ".jpg",
               UriKind.RelativeOrAbsolute));
      image2.Source = new System.Windows.Media.Imaging.BitmapImage
         (new Uri("BrainImg/aseg/" + axis + currentSlice + ".png",
               UriKind.RelativeOrAbsolute));
  }
  
  private void slider1_ValueChanged(object sender, 
                                    RoutedPropertyChangedEventArgs&lt;double&gt; e)
  {
      // do something
      if (this.slider1 != null)
      {
          currentSlice = (int) this.slider1.Value;
          displayImages();
      }
  }
  </code></pre>
  
  <p>After some changes (approximately 100 I ran out of memory)</p>
  
  <p>I have already tried setting the <code>image.Source</code> to <code>null</code> before assigning a new value.</p>