Why is .NET using more memory on a system with less RAM?

Viewed 172

We have two systems used for testing, both running latest Win10 Pro. One of them has 8 GB of RAM, the other 32. We run the same binary and do the same operations in each of them.

The program's memory usage (as shown by Task Manager) on the 32 GB system goes up to around 2.5 GB and stays there, with some "noise" caused by the GC as expected.

On the 8 GB system, the program uses as much memory as it can, and when the global memory usage reaches about 90-95% it seems to run a massive GC pass. Its memory usage is jumping around between anything from 1.5 GB to 5 GB. Other processes are swapped out and generally speaking the system eventually starts to slow down. If you exit the program, or stop it and press the GC.Collect() button that we hacked in for this test everything returns back to normal as things are swapped back. If this is any useful, pagefile.sys is set to being "managed by Windows" and sits around 8 GB with Windows recommending 1.8 GB instead (but not doing the change).

What settings, .NET or Windows could be causing this? We're not doing anything fancy with the GC from our code, except for that debug button mentioned above. We have a few GC.KeepAlive() calls but those by definition do nothing, just extend variable scope. The program is otherwise memory leak free, we can keep running it indefinitely and it never goes out of memory.

0 Answers
Related