title: Memoryleak when using ICollectionView with Entity Framework
body: <p>So in my application I use an ICollectionView of Products, which is bound to a DataGrid with DataBinding. The Products come from a MS-SQL table and this table is quiet big (~30.000 entries). At certain points I need to reload the table as its contents might have changed. </p>
  
  <p>Whenever I call ReloadProducts() ~30.000 new objects are created. The  previous objects are not freed up and remain in memory for whole the live of the application.</p>
  
  <p>Any idea how I could force a disposal of the old objects?</p>
  
  <p>ViewModel:</p>
  
  <pre><code>private ICollectionView _productCollectionView;
  
  public ICollectionView ProductCollectionView 
  {
      set { _productCollectionView = value; }
      get
      {
          if (_productCollectionView == null)
          {
              ReloadProducts();
          }
          return _productCollectionView ;
      }
  }
  
  public void ReloadProducts()
  {
    List&lt;Products&gt; productList = Entities.Products.ToList();
    ProductCollectionView = CollectionViewSource.GetDefaultView(productList);
    NotifyPropertyChanged("ProductCollectionView");
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>&lt;DataGrid ItemsSource="{Binding ProductCollectionView}" AutoGenerateColumns="False"/&gt;
  </code></pre>