0

I have a .Net core 2.2 console app, which uses EF core internally for db calls. It runs as scheduled service using topshelf and quartz.net. I observe memory usage of this console keeps on increasing until it reaches to 90% of server RAM, i don't know if it can keep on taking more RAM than that as once it reaches to that margin i generally shut it down and restart again.

I am unable to share code here as project is vast and unable to narrow down what might cause this. Though I have inspected code enough, and there is nothing in code which can make app keep on holding to older memories/objects.

I also inspected dump file using one of dump analyzing tool and see around 50% of memory is used by string values(which all loose scope quick but are large data) and for rest; most of memory is used by EF core(change tracker to be precise). I am doing large json creation in loop for list of db rows, but all that shall be freed/collected up sometime as those are all part of List of managed objects and loop looses its scope quickly.

Did anyone face similar issue where in a scheduled .net core 2.2 app doesn't seem to have GC collection fired or memory not being freed in general when left for running for few days, considering code seems fine for memory leakage.

LearningNeverEnds
  • 374
  • 1
  • 3
  • 22
  • Possible duplicate of [Memory leak when using Entity Framework](https://stackoverflow.com/questions/30209528/memory-leak-when-using-entity-framework) – Joshua Robinson Oct 10 '19 at 14:07
  • @JoshuaRobinson I am not sure if you down voted question or not over "possible duplicate". If you are not behind downvote then please ignore this and leave for one who did but if you did then it is nowhere close to being possible duplicate of either that question or its answers as none of those fit here. i have been coding with EF for many years by now without such issues and don't need those novice suggestions to fix memory leakage in EF. What i am dealing with has something to do with a .Net/EF CORE console app running 24/7 for days together and not freeing up any memory for unused objects. – LearningNeverEnds Oct 10 '19 at 16:19
  • i have asked this question after seeing stuffs like this: https://github.com/aspnet/AspNetCore/issues/3409 and similar ones on .Net console. – LearningNeverEnds Oct 10 '19 at 16:37

1 Answers1

1

Double check everything touching Quartz.net. Quartz.net may be hanging onto references that you believe should be GCed.

If you use a proper memory tracker like dotMemory will help you track exactly what objects are not being freed.

Jack Hughes
  • 5,514
  • 4
  • 27
  • 32