[Debugging] Application high memory usage on Windows 8.1

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 accidently left some GFlags setting configured.

Reminded me of a customer who had an issue wherein all the application 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.

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.

image

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…

image

So if you have application verified standalone application installed on your box you’ll see your application listed there 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. Smile

Appreciate your comments...