Nov 052013
 

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.

image

 

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…

image

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. Smile

May 112009
 

Are you having trouble with VS2008 after conversion from VS2005 to VS2008? Most common complaints are that the executable is way to slow when compared to it’s counterpart generated with VS2005. The reason for this is given in this MSDN forum thread have a look…

http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/fb32033b-7bad-439b-a94c-943a17f0cbb2

The essence of this thread is given below (quote from the thread, thanks to Jon Baggott)…

In Visual Studio 2008 SP1 (SP1 not RTM) there is a serious bug with /O2 optimization. One way this bug can be triggered is by upgrading a project from a previous version. Even though the project setting shows the release build is set to /O2, the build can be not optimized at all. To work around it you have to change the setting to no optimization, apply, and then change it back to /O2. The quick way to see if this is needed is to check whether the setting for optimization is in bold or regular – if’s it’s bold you’re OK; if it’s regular text you’re not. This bug has been reported to Microsoft by many people over the past few months via the Connect feedback site but every case has been closed by them without doing anything and for completely invalid reasons.
Aug 052008
 

I can’t just bear the intellisense of VS2005. So went out to find ways to disable this feature since I have another intellisense (you know right?) 😉 package from a private vendor.

Here are some ways to disable this feature in VS2005…

  1. Rename \Program Files\Microsoft Visual Studio 8\VC\vcpackages\feacp.dll
    I’ve renamed it to “feacp.dll.renamed_to_disable_intellisense”. Hehe
  2. Open .ncb file of your project exclusively and then open your solution. You will get a warning which you will enjoy seeing. Take a look

Helped me a lot. Hope Microsoft(r) fixes this crap soon!! 😐 Sometimes I do wonder, didn’t they test this at all ? 🙁

Most probably you can do the same in VS2008. But not everybody is as lucky as I am. I have another intellisense software but don’t know whether others have the same option.

[Update]
http://blogs.msdn.com/vcblog/archive/2007/11/19/controlling-intellisense-through-macros.aspx
[/Update]

May 302008
 

Some useful shortcuts for development in different versions of visual studio for VC++…

  1. Ctrl + Alt + L – Solution explorer
  2. Alt + Enter – Properties window
    Works even on open files in the IDE. Lists the properties of files like full path etc. If in resource editor then it shows properties of controls
  3. Ctrl + Shift + F8 – Helps in selecting blocks of text using keyboard navigation keys, press escape to break out of this behavior
  4. Alt + 0 – VC6 – Shows workspace window
  5. Ctrl + Pagedown/Pageup – To navigate through the tabs in the output window or the workspace window. Works even in excel to navigate through worksheet tabs
  6. Ctrl + Shift + E – Opens resource explorer window
  7. Ctrl + Shift + C – Opens class view
  8. Ctrl + Shift + B – To start building
  9. Ctrl + F8 – VC6 – Turns on sticky shift, enters selection mode by selecting current line, use arrow keys to move selection up or down. Press escape when done
  10. Ctrl + Alt + O – Open output window
  11. To navigate through errors, use F8 in VS7 and above and F4 in VS6.
  12. Shortcut heaven in VC6, if interested to learn new shortcuts goto this dialog and the marked place. Press some shortcut keys to see what they are meant for. This is how I learn about new shortcuts in Microsoft products, it’s a standard feature in nearly all of their products. Goto Tools->Customize.
    Navigate through the category combo and command list to find out about new shortcuts. If you are using VC6 you can get a list of existing shortcuts using Help->Keyboard Map, take a print out stick it in your cabin, every now and then have a look at the list and implement these one by one. Shortly you won’t using mouse too much, will save time. :)This dialog is found in VS6 and equivalent one exists in some or the other form in other versions of visual studio too. So have fun learning these shortcuts.