My wpf app is eating memory every time the ItemsSource of a TreeView is replaced (I simply construct a new object and assign it to the bound property). Furthermore the memory hoarding only occurs when I use a DataTemplate that is used in other ItemControls too. When I remove the DataTemplate the Treeview reverts to displaying the ToString() method of the bound objects, but the memory loss stops.
Can anyone help me about how to troubleshoot this? Are there any resources on the internet about this topic?
I found a further link with useful information about WPF memory leaks.
There are some scenarios which may cause memory leaks in WPF.
Here are some references which may help:
http://blogs.msdn.com/jgoldb/archive/2008/02/04/finding-memory-leaks-in-wpf-based-applications.aspx
http://blogs.msdn.com/micmcd/archive/2008/03/07/avoiding-a-wpf-memory-leak-with-databinding-black-magic.aspx
http://support.microsoft.com/kb/938416/en-us