I\'m building a WPF app that connects to a SQL Server database using LINQ to SQL.
The main window of the app contains a ListView containing a series of
One of the "new" challenges that programmers must deal with when using MVVM is that the ViewModel doesn't automatically clean itself up. If you set a property which causes a view to load, then change that property, the old object is not necessarily automatically disposed. It may sit on the GC for a long time before it's cleaned up.
It's especially tempting to use LINQ to build your ViewModel collections, but you must be very careful. LINQ will return new instances of your objects on each call, potentially creating memory leaks and state problems.
All that said, I don't see nearly enough information in this question to help you identify the source of your leak (and far too much irrelevant information). Your best bet is to standardize your ViewModel creation pattern, using Factory or something similar, so that you are only generating a new instance of a ViewModel when you intend to and so that you can keep track of instances and kill them as needed.