Background
There is a related post here on the CSLA.NET Forums. The forum doesn’t allow images. The Ants Memory Profiler screen captures may be useful so they are in this post. A bunch of images would just look weird, so this post contains more detail.
While writing a replacement application for an Access DB I wrote about 10 years ago for a client, I discovered a memory leak when importing data from the access source. The application is not just a replacement but an upgrade to both the DB and the Business Logic. It’s now a ASP.NET MVC based using CSLA.NET with a SQL DB. The DB import isn’t just copying the tables over directly; the entire table structure has been changed. To limit the amount of dedicated code, the import uses the CSLA Business Objects.
During development a situation occurred where remote users of the Access application weren’t able to consistently use it, and eventually not at all. So that meant a slight refocus on the development effort to get the portion that they use up an running. Unfortunately when I tried to import the full database, the application crashed several hours into the import due to a OutOfMemoryException. This was two weeks into what I estimated to be a three week effort. The next five days were spent finding where the memory was leaking. It probably would have gone faster if I had just gotten Ants Profiler from the start, but I was convinced it had to be something I was doing in my Business Objects and thought I could use the memory profiler built into Visual Studio 2008.
More...