High Memory Usage Scenario
Recently had a customer who was complaining about high memory usage on Windows 8.1. The application consumed about 140 MB on a Windows 8.1 OS as compared to a meager 3 to 4 MB on a Windows 7 or 8 machine.
Hmm interesting. Being experienced in troubleshooting for sometime now this smelled to me like an issue with some kind of debug flag settings. So immediately checked with customer if he has accidentally left some GFlags setting configured.
Reminded me of a customer who had an issue wherein all applications on his box started showing high memory usage, eventually this turned out to be an issue with a system wide flag configured via GFlags. GFlags is a helpful tool but please do remember to undo the changes once you’re done with the debugging. Probably stick a sticky somewhere which will hint you to turn off these settings.
So coming back to this incident, hmm why would the application consume high memory on Windows 8.1. Note: He had the application compiled using VS2008.
Memory Dump Analysis for High Memory Usage
Checked memory dump of Test.exe running on Windows 8.1 in our debugger and saw that it has some heap validation features enabled. This is the reason why huge amount of memory is being consumed since these heap validation features will require extra memory.
0:000> !heap Index Address Name Debugging options enabled 1: 00300000 tail checking free checking validate parameters 2: 00c20000 tail checking free checking validate parameters 3: 00200000 tail checking free checking validate parameters 4: 02170000 tail checking free checking validate parameters
I was bit surprised as the customer said he doesn’t have GFlags on his box. So I renamed Test.exe to Test1.exe and this is what the dump shows now. Looks like someone’s enabling heap validation flags on Test.exe.
0:000> !heap Index Address Name Debugging options enabled 1: 001d0000 2: 00c20000 3: 02220000 4: 00390000
The application memory usage, after renaming, came down to 3.5 MB.
Cause of High Memory Usage
Eventually we figured out who’s turning the heap validation flags on. The integrated Application Verifier included in the Visual Studio Team Suite and Visual Studio Team System for Developers versions of Visual Studio was turning these features on and that was expected as well. The customer had pro version hence he probably didn’t see the settings in project properties. This is how the project property pages will look like…
So if you have application verifier installed on your box you’ll see your application listed as Visual Studio turns certain registry settings on/off based on your settings. Once your application starts up these settings will take effect. Troubleshooting is fun isn’t it.