locked
Why is Visual Studio 2010 using CPU when it's not doing anything?

    Question

  • Hello,

    I am running VS2010 Pro on an i7 machine with 12Gb RAM. I have noticed that when VS is running, it will start using loads of CPU, even when I'm not using it, and it's not supposed to be doing anything. For example, right now it's using about 50-60% of one processor, and smaller amounts on other processors. I haven't touched it for about 15 mins, as I've been searching around trying to find a solution to the problem. It's just sitting there with a Lightswitch project open, in design view, not running or debugging.

    It doesn't seem to make any difference what type of solution I have open, the problem appears with WPF, Lightswitch, etc.

    I tried running VS with a log, simply opening a solution and not touching it, but after the initial start up, nothing is written to the log, even though it's still consuming CPU.

    Anyone any ideas? Thanks


    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    Monday, April 30, 2012 5:03 PM

All replies

  • Intellisense scan running maybe?  Look in the status bar at the bottom for signs about # of files scanned or if it just says "Ready".
    Monday, April 30, 2012 5:19 PM
  • Run in safemode to eliminate any extensions and then use Process Explorer to monitor the threads that are running. 

    Michael Taylor - 4/30/2012
    http://msmvps.com/blogs/p3net

    Monday, April 30, 2012 7:33 PM
  • 1. Start a Visual Studio, empty it(close all solutions, this is my configuration for my Visual Studio)

    2. Then use the Process Explorer tool to monitor which threads in this Visual Studio process consuming your CPU resource

    For more procexp tool usage problem, you can use this forum.

    I think this would be a special environment issue, my CPU costs for Visual Studio process only about 0.22%.

    So I also recommend you check it in a safe mode as CoolDadTx said, and also try reset.

    You need locate to the IDE folder then run these commands, or you can set path to the system environment.

    The following path is the vs2010 in my system, and you can use this for reference.

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE

     

    Devenv.exe /SafeMode  Launches the IDE in safe mode loading minimal windows.

     

    Devenv.exe /ResetSettings    Restores the IDE's default settings, optionally resets to the specified VSSettings file.

     

    Devenv.exe /ResetAddin       Removes commands and command UI associated with the specified Add-in.

     

    Devenv.exe /ResetSkipPkgs  Clears all SkipLoading tags added to VSPackages.


    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, May 01, 2012 3:25 AM
  • Hello to all of you, and thanks for the replies.

    Well, I'm driving myself mad here and not getting anywhere. I haven't found any rhyme or reason to when VS uses so much CPU, and haven't yet convinced myself that it is anything to do with my extensions. Part of the problem is that I rely on some of them for my work, so it's not practical to disable them.

    I've tried using process monitor, but I haven't a clue what I'm supposed to be looking at. Also, the list of threads changes to quickly, it's impossible to tell what's the culprit.

    I've also tried logging, but predictably, VS doesn't hog the CPU when I'm logging, it waits until I start it normally and then hogs the CPU!

    By the way Mike, I have never seen VS use CPU when it's open without any solutions loaded. This could be because I never do that (wouldn't be much point), but I've only seen the CPU hogging with a solution loaded.

    What I would really like to do is clear VS off my machine completely, then reinstall with the minimal extensions I need, and see what happens. I can add the others one at a time and see what happens. Trouble is, my past experiences of uninstalling VS were horrendous.

    Do you know if there is any way of completely removing VS? I mean everything, folders, registry entries and so on. If I could do that, it might help.

    Thanks again.


    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    Wednesday, May 02, 2012 2:31 PM
  • Uninstalling and reinstalling just to determine if it is some extensions seems extreme.  Run VS in safemode for a while and see if the problem occurs.  You mentioned that it occurs frequently so you should be able to replicate rather quickly.  If running in safemode does not cause the spike then it is one of the extensions.  At that point run VS normally but disable some extensions (either one by one or in a group) until you identify the culprit.  If you can't live without some extensions and they are the one's sucking up the CPU then you're going to have to decide whether you can live without them or live with the CPU spikes.

    Michael Taylor - 5/2/2012
    http://msmvps.com/blogs/p3net

    Wednesday, May 02, 2012 3:03 PM
  • Hello Michael, thanks for the reply.

    I agree that uninstalling and reinstalling VS is an extreme step, but I'm pretty hacked off with the amount of resources it consumes. Fairly regularly, when I start VS, it shows me a window telling me it's loading user settings. This can sit there for five minutes, not doing anything visible. I have a solid state drive (data access at around 5.5-6Gb/s), so reading a fairly small XML file shouldn't take five minutes. Other developers I know have seen this as well.

    I'll try disabling all but my most important extensions and see what happens. I've been through this before, and didn't get anywhere, but it's worth another try.

    Thanks again.


    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    Wednesday, May 02, 2012 3:13 PM
  • Usual suspects:

    • Virus Scanner / Malware.
    • Additional hardware (particularly USB devices such as USB thumb drives, USB displays, USB sound cards, etc.)
    • Disable all nonessential services.
    • Terminate all nonessential processes.
    • Disconnect from network.
    • Try on another machine.
    Wednesday, May 02, 2012 3:41 PM
  • Usual suspects:

    • Virus Scanner / Malware.

    Already have my virus scanner set to ignore the VS install folders. This reduced the build time of a large solution from about a minute to under ten seconds!

    Anything else that I can do in this respect?

  • Additional hardware (particularly USB devices such as USB thumb drives, USB displays, USB sound cards, etc.)
  • Nope, none of those. The only USB stuff attached to the machine are the keyboard, mouse and a printer.

  • Disable all nonessential services.
  • Did that when I first installed Windows.

  • Terminate all nonessential processes.
  • I don't think I have any! Task manager doesn't show anything other than stuff I need, or can't remove.

    Just out of interest, how would other processes and services affect the amount of CPU used by VS?

  • Disconnect from network.
  • Haven't tried that, but as the router is sitting on the wall right next to me, I can see network activity, and it's usually fairly low. Certainly not high and prolonged enough to explain VS's mad use of the CPU. Also, unless it's VS accessing the network, how would this explain the problem?

  • Try on another machine.
  • Almost impossible to reproduce a system configuration, but I have asked other developers I work with, and they say the same thing. Some to more or less degrees, but everyone I've asked complains about the high use of resources.

    One of the problems is that I'm the sort of person who has a CPU monitor gadget on the desktop, and keeps an eye on it to see if anything unusual is going on. That's how I spotted this. Most people I know don't do this, so wouldn't necessarily notice if VS was using a lot of CPU, unless it affected the whole machine. As I have an i7, even if VS hogs two CPUs, it still leaves six for other things, so doesn't necessarily cause any problems.

    All of which does make me wonder why I'm so bothered about it in the first place! I guess I'm a bit weird that way!

    Thanks for the reply. Any further suggestions welcome.


    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    Wednesday, May 02, 2012 5:06 PM
  • You need to come up with a situation where Visual Studio is running but is not consuming CPU.  My machine is doing this right now.

    Download Process Explorer and run it.

    Open up the devenv.exe process and view properties (right-click > properties... or just double-click it)

    Click the "threads" tab.

    The threads of devenv.exe are sorted by CPU usage. (if not, then click the CPU header to sort them by cpu usage)

    Click on the thread that is using cpu and click the "stack" button.  Do this a number of times until you catch it in the act of doing something it shouldn't be doing.  You can determine which modules is loaded and what code it is executing.  You can also suspend the thread and see if CPU usage goes back to normal.

    Wednesday, May 02, 2012 8:54 PM
  • Alternatively you could just use ProcDump to monitor VS and take a snapshot when the CPU spikes above a certain level.  Start it up after VS is running and it'll generate a memory dump when VS exceeds the CPU limit.  The dump can then be loaded into VS with the full callstack information.  I think you're going to find it is a plugin though.  CodeRush and Resharper are notorious for eating up idle CPU cycles.  Could also be any references to files on a network.

    Michael Taylor - 5/2/2012
    http://msmvps.com/blogs/p3net

    Wednesday, May 02, 2012 10:42 PM
  • CodeRush and Resharper are notorious for eating up idle CPU cycles.

    Ah, that could explain it then, I have R# and never leave home without it!

    I might try suspending it for a while and see if it makes any difference.

    Thanks for the reply.


    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    Thursday, May 03, 2012 7:49 AM
  • I am writing to check the status of the issue on your side.

    What about this problem now? 


    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us

    Monday, May 07, 2012 9:07 AM
  • Hi Mike,

    Well, I haven't really come to any conclusion as to what's causing the CPU usage, but I have become less worried about it! I think I was overreacting to the whole thing, probably as a result of having a CPU meter gadget on my desktop, so I could see it hacking away at the CPU when it wasn't supposed to be doing anything. As long as it isn't slowing anything else down (which it doesn't as far as I can see), I've kind of stopped worrying about it.

    The one area where it does bother me is when editing XAML files in the design editor. Often, I can change a simple value (say the width of a control), and VS will suddenly use loads of CPU for up to 30 seconds, before I see the values I typed appear on the screen. This is fairly intermittent, and only happens on XAML files, and possibly only happens with one specific solution, so would be fairly tricky to pin down. At some point, I may investigate it further, but for now, I think I'll leave it alone.

    Thanks for all the help.


    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    Tuesday, May 08, 2012 10:32 AM
  • You're welcome, and have a good day!

    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us

    Thursday, May 10, 2012 11:37 AM
  • I have a similar situation. When I open VS, normal CPU. When I open any project, I take some time high CPU and disk activity => normal. After I get the ready status, CPU keeps high (12-13% of total, meaning about one core at 100%). Even if I leave it there for one, two, ... hours. Once, I forgot to close down VS in remote session and after a whole night, it was still running constantly at 13%. And I have zero plugin's running, it is a quite simple solution, and I'm really sure nothing's happening. When I rebuild complete solution, CPU gets even down to 2-10%!!!

    Tried all of the above, and the only thing that's helping is when using devenv.exe /ResetSettings.
    Another thing that helped is opening and closing some windows, like for example the Solution Explorer, Toolbox or even output window.

    If anyone can help, it will be greatly appreciated, as in my case, after 10 minutes, my fans start spinning faster with more unnecessary noise.

    Wednesday, September 12, 2012 9:45 PM
  • While VS is running idle use Process Explorer to see what thread(s) in VS are eating up the CPU. 

    Michael Taylor - 9/12/2012
    http://msmvps.com/blogs/p3net

    Wednesday, September 12, 2012 10:08 PM