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 )
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