'Why does my application use more memory on Windows 10?

I have a C++ application compiled with Visual Studio 2010. This is a large legacy application with multiple threads servicing sockets, database connections, RV market data streams etc.

On Windows 7 the application runs fine and consumes around 700MB of memory in normal use with very little fluctuation once it's up and running.

The exact same binaries when copied onto my Windows 10 machine run out of memory within around 15 seconds of starting.

I've used SysInternals procexp64.exe to monitor memory usage. On the Win7 machine I see the Virtual memory usage hovering around the 700MB mark. On the Win10 machine the virtual memory usage climbs steadily until it hits the 2GB mark within seconds of starting and then throws an out of memory exception. I've set the LargeAddressAware flag in the linker settings and then it behaves the same way, throwing the out of memory exception when it hits 4GB.

What's different about memory allocation between the Win7 and Win10 platforms that could explain this problem?



Solution 1:[1]

I managed to track down the reason this application was running out of memory on my Windows 10 workstation.

Yes the application is a hot bed of undefined behaviour, uninitialised variables and all kind of other unspeakable things. But it's 20 years old and comprises 500 kloc over many thousands of files so fixing all of those isn't an option.

And it works fine on my Windows 7 machine. It does have an out of memory handler set. I put a breakpoint in there. When it stopped I looked at the modules that were loaded and compared those to the ones on my Windows 7 machine.

One glaring difference was... verifier.dll. It turns out this Windows 10 workstation I've been given is not new and had pageheap analysis enabled through gflags. The additional memory used by this was causing the problem. Switching off pageheap analysis using gflags.exe made my out of memory problem go away.

Solution 2:[2]

For me it was Office 365 and OfficeClickToRun.exe. There are also some tasks specified in Task Scheduler for Office.

I've uninstalled Office 365 and installed Office 2019 Pro. Bonus: search in Outlook finally works :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Christopher Rosol