I'm dealing with my C# program memory usage I set up a memory control between the start and the end of my app to spot memory leaks. I got warning when using Entity Framework 6 with Firebird:
var m = GC.GetTotalMemory(true) / 1024 / 1024; // 2MB using (Entities context = new Entities(ConnectionString)) { m = GC.GetTotalMemory(true) / 1024 / 1024; //2MB context.MYTABLE.FirstOrDefault(); m = GC.GetTotalMemory(true) / 1024 / 1024; // 5MB } m = GC.GetTotalMemory(true) / 1024 / 1024; // 5MB ?? By commenting out the context.MYTABLE line, memory will remain at 2MB.
I know everything will be disposed when the application will end, but I would like to detect memory leaks on my objects and this EF problem prevent that.
Is there a way to dispose this extra memory used by EF?
Could this problem be caused by the Firebird EF driver?
Tia
DebugorReleasebuild?DbContexttype and cannot be released (as usual withstaticvariables).