I ran into the same problem and after a long day I found a solution in one of the github issues registered for high memory consumption.
Actually, this is the expected behavior (in a multi-core machine with a large amount of memory), which is called the βServerβ garbage collection mode. This mode is optimized for server loading and starts the GC only when it is really necessary (when it starts to run out of memory in the machine).
The solution is to change the GC mode to Workstation mode. You can do this by adding a parameter to your .csproj
<PropertyGroup> <ServerGarbageCollection>false</ServerGarbageCollection> </PropertyGroup>
Workstation mode is designed to use less memory, but more often it starts the GC.
This is well documented by Sebastian Ros here: https://github.com/sebastienros/memoryleak
In a typical web server environment, the CPU resource is more critical than memory, so it is better to use a server GC.
dvd94 source share