Memory problem with Entity Framework 4.3 RRS feed

  • Question

  • We have an Net-application using WPF for GUI and Entitiy Framework 4.3 for database connection.

    We are using a repositorypattern with  UnitOfWork-objects that holds the EF-context.

    We have problem when we do a search against the database, the memory used by the application increases with every search.
    All communication with the database goes through serviceclasses and we create a new instance of these classes for every search.

    When we analyze the result from Ants Memory Profiler we see that all of our own objects seems to "die" between every search, the number of instances does not increase.
    But for some objets in the system.data-namespace, for example EntityKey , the number of instances and memory used increases for every search.
    We wonder why the GC does not remove these objects?  We create new instances of our UoW-object and EF-context in every instance of the serviceclasses. The UoW object  implements IDisposable and dispose the EF-context.

    We can see that a couple of the EntityKey-instances are "GCRoot Object" , can that be a cause to the problem?

    Monday, September 17, 2012 5:57 PM

All replies