You can try to detach each object in context.
Max is right, but when you want to do something that takes a lot of time, the context stores many objects and continues to grow in memory and slows down your application.
It causes a memory leak.
I have this problem with EntityFramework 6 now, but I donโt know how to "exactly" fix it.
Whenever I need to make a request, I get the context and do it, but this action is different, I have a lot of things to calculate in a loop, and I keep the context to the end. At the moment, I delete my list after a flash, but I still have leak memory in my system, and the context has this problem with certainty. Anyone suggest a "team"? I do not know if the entity infrastructure works.
source share