-
Hello, I have a bit of a tricky problem. I have a Linux web app running on Azure (B4 instance) under .NET Core 3.1.11 which does also perform big batch processing jobs. I can see that the memory usage keeps going up during that processing (and down when an automatic GC kicks in) Now the funny thing is, that when I place a manual GC in the processing loop (let's say perform a GC every 10th large object processing), the memory usage tops out stable around 80% and not even comes close to 100%. I do the manual GC as follows:
and my GC settings are:
Any idea how I can fine-tune the GC settings that I can get rid of the manual GC's. Thx a lot. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 24 replies
-
It sounds like caused by LOH fragmentation. I'm not sure how the runtime is configured for that, but manually require compaction of LOH should be the right way. |
Beta Was this translation helpful? Give feedback.
-
You can try setting HeapHardLimit or HeapHardLimitPercent: https://docs.microsoft.com/en-us/dotnet/core/run-time-config/garbage-collector#heap-limit-percent. It will tell GC to stay under the given limit. Also, you can try turning off server GC by setting |
Beta Was this translation helpful? Give feedback.
You can try setting HeapHardLimit or HeapHardLimitPercent: https://docs.microsoft.com/en-us/dotnet/core/run-time-config/garbage-collector#heap-limit-percent. It will tell GC to stay under the given limit.
Also, you can try turning off server GC by setting
<ServerGarbageCollection>false</ServerGarbageCollection>
. The server GC has better throughput, but it also needs more slack space to do a good job.