BindingList<>.Clear() appears to cause Memory leak

BindingList<>.Clear() appears to cause Memory leak

Although similar to I just want to be clear that this is the same issue/will be solved by v1.2.

I have a BindingList<> of internal business objects. These objects are dynamically created at run time. The BindingList<> is added to a DataGridCollectionView which is set to the Grid’s ItemsSource. The columns are bound to properties of the business object.

This all works fine. The data (and number of rows) of the BindingList<> changes often during the grid’s lifetime (the grid is used to allow users to compare WindTunnel data).

When the data changes, it is likely that all the rows of the BindingList are changed so initially I cleared the BindingList using the Clear() method and then did an Items.Refresh(). The new data is added and displayed correctly.

However, over time the memory of the application grows and is not released during garbage collection. Looking in WinDbg there are all the business objects – even through they have been removed from the BindingList<>.

I have been able to reduce the effect of the problem by reusing the business objects and only removing the “extra” ones as required. However, the memory still grows if the number of rows in the grid changes often.

I am using v1.1 plus the service pack (v3.0.7273.12150). If this is solved in v1.2 then good, otherwise are there any suggestions about how to improve the memory usage of the grid as this is a problem for using the grid in our production environment.