efcore icon indicating copy to clipboard operation
efcore copied to clipboard

EF Core memory leak

Open yoganr opened this issue 2 years ago • 3 comments

We have memory leak in our application which grows over a week. Help would be appreciated on why Heap generation 2 grows and why ServiceProviderEngineScope is retaining so much memory. Here are dotmemory tracking,

image

Here is the dominators map

image

Thanks in advance

yoganr avatar Aug 12 '24 12:08 yoganr

Consider the correct way of using .AsNoTracking() in your project whenever you don't need or want to edit or manipulate fetched data (it often happens in report usage scenarios)

RezaRahmatzadeh avatar Aug 13 '24 21:08 RezaRahmatzadeh

@yoganr Please post the OutOfMemoryException, including stack trace.

ajcvickers avatar Aug 14 '24 08:08 ajcvickers

@yoganr Please post the OutOfMemoryException, including stack trace.

We got it solved the memory leakage in our singleton class which was resolving Services from root scope, when we change it to create new scope seems to resolved the issue. Thanks for the help guys!

yoganr avatar Aug 23 '24 07:08 yoganr