Xcode 9 uses too much CPU

Hi,

I've recently updated my Xcode to Xcode 9 (the official version) and I've noticed that it seems to constantly use more than 200% of my CPU, even when the app shows no running processes. No other apps are launched (including the iOS emulator), Xcode isn't building any code, and its "progress/loading" bar is empty. Yet, Activity Monitor reports that Xcode is using 200% of my CPU.


Why does Xcode need so much CPU by itself?


My hardware/software specs are:

  • MacBook Pro 15" Mid 2010
  • Dual core Intel Core i7 (2.66 GHz)
  • 8GB RAM
  • SSD
  • macOS High Sierra (official)
  • Xcode 9.0 (9A235)


Thank you!

Accepted Answer

I had the same experience for the first few days after I installed Xcode, but, then it settled down to more normal usage. I've read that there is a bunch of indexing being done (help, other stuff) that will run in the background if you are doing real work, but, if it's not doing anything else, it grabs CPU and memory to work on the indexing databases. Similar to what Spotlight does with a new macOS install. In fact, one of the big users along with Xcode itself was the mds indexer and mds worker threads, which are used, I think, by Xcode and Spotlight for index maintenance. The other complicating factor I ran into was Time Machine backups, because all kinds of new data was being generated that would be backed up. It all finally worked itself out, and now Xcode normally works like it did before.


Although, every once in a while, after a bunch of compiling and source code re-arranging, Xcode seems to go off the deep end, and I have to force quit it and restart. Not sure what's going on, because, everything is the way I wanted, and builds completed when it comes back up. Also happens when in a low free memory situations (500 MB left on a 16 GB machine), so I've been a little more frugal in what I keep open when I use Xcode a lot.

I have a 16 GB machine, and with Mail, Dash, Safari, and Xcode 9 running, I can get into situations where Xcode has 13 or so GB of memory charged against it. That's when it seems to go off the deep end, and I have to force quit. When Xcode is forced quit, I immediately get 11-13 GB of memory back. Something is going squirrely sometimes. Suspect that as 9.1, 9.2, 9.3, ..., come along the situation will get better. Has before.


Hard drives only, no SSD.

8 GB ram? Can you max that out?


How much free space on your SSD?


>including the iOS emulator


The simulator is not an emulator, and only runs a stack built for i386, your computer.

Thank you for your reply! I did notice the next day that the CPU consumption was considerably less, although ocassionally it would sharply increase for periods of time. I found that using by iPhone as a simulator device also helps lower the consumption as the iOS processes can be handled by my phone.

Xcode 9 uses too much CPU
 
 
Q