Memory leak in (MVC) application

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
Posts: 3
Joined: Wed 29 Apr 2009 14:17

Memory leak in (MVC) application

Post by jauco » Mon 26 Oct 2009 09:48


We have developed an ASP.Net (MVC) application that uses your linq2mysql component. As it happens we have a quite severe memory leak. We are not completely sure what causes the leak, but running profiling applications do show that some disposed devart objects aren't collected by the garbage collector (even when explicitly calling GC.collect)

This suprises us because, partially due to the way the asp.Net MVC framework is built, each request should be stateless and no references to the devart object should exist after the request ends.

So in order to find the memory leak we'd like to make sure that we are using the datacontext correctly. ATM for every request, we build a new datacontext using

Code: Select all

new DataContext(ConfigurationManager.ConnectionStrings ["MySqlServices"].ConnectionString )
when the request ends, we have both tried calling and not calling Datacontext.Dispose() (for debugging purposes we have followed this by GC.Collect() )

Afterwards the object that contained references to the datacontext is destructed (we can verify this) We expect that this results in the destruction of all objects that have been created using the datacontext, as the reference to the datacontext is removed.

The profiler then tells us that a lot of EntityEntries or EntityCache objects are disposed but not collected. As well as a Devart.Common.i object.

I'm not a memory leak expert, but you'd help me a great deal if you could tell me:
  • How should we use the datacontext (is a new one per request feasible)

    Are the dispose calls called in the destructors of the devart objects

    do you keep caching information, and can we remove the cache

Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 27 Oct 2009 11:31

The similar problem was solved in one of the latest builds of dotConnect for MySQL.
Is the problem reproducible with the latest 5.40.49 build?

Post Reply