18

I've been having issues lately with the latest version of Xcode 5. About a minute or so after launching CPU usage and Real Memory usage skyrocket. I've seen CPU usage as high as 400% and RAM usage as high as 13GB.

I'm on an i5 iMac with 16GB of RAM.

I've tried uninstalling Xcode and reinstalling, running all Mountain Lion upgrades, fixing recurring header loops, launching Xcode without indexing and a few other issues all to no avail. I'm now at a loss as to what I can do.

Activity Monitor after running Xcode for a few minutes. No compiles or anything

I would love suggestions of things to try. I've tried running my project on other i5 iMacs and I don't have this issue.

Thanks everyone.

Jim
  • 2,300
  • 1
  • 19
  • 43
Andrew Kozlik
  • 1,189
  • 1
  • 11
  • 15
  • Make sure you clear all the derived data, and other junk that may be laying about in `~/Library/Developer/Xcode`. – Hot Licks Sep 25 '13 at 20:30
  • What a strange event. More possible answers here: http://stackoverflow.com/questions/12295113/xcode-use-big-memory-eat-all-memory-of-ram – IanStallings Sep 25 '13 at 20:32
  • 1
    Hot Licks - Thanks for the suggestion. Unfortunately I tried deleting everything under there as well with no luck. In fact I had to kill it once again just to post this comment. :( – Andrew Kozlik Sep 25 '13 at 20:41
  • 2
    @IanStallings - I tried running through that thread but unfortunately none of the suggestions worked. thank you though. – Andrew Kozlik Sep 25 '13 at 20:42
  • @AndrewKozlik, I face the same problem. Did you find the solution? If yes please reply me. – utkal patel Oct 10 '13 at 06:08
  • It's pretty annoying. I have filed a radar #15198094 – ppaulojr Oct 10 '13 at 17:02
  • I suggest all people having this problem to report it at https://bugreport.apple.com – ppaulojr Oct 10 '13 at 17:03
  • Is there any network activity from Xcode when its CPU is high? – FractalDoctor Oct 14 '13 at 09:55
  • I'm assuming that you have no program open when this is occurring? And I'd definitely check the network activity as Fiddle suggested. – Meshach Oct 15 '13 at 00:32
  • Do you use git? I was able to fix an issue where Xcode was constantly killing 200% of my CPU by adding / committing my pending git changes. [Here is the breakdown](http://stackoverflow.com/questions/10522936/xcode-4-3-2-and-100-cpu-constantly-in-the-idle-time/23679448#23679448) of what happened with me. – n8tr May 15 '14 at 13:24

6 Answers6

16

I had this exact problem over the weekend with my Macbook Air and Xcode5. I tired resetting Xcode back to default, deleting the iOS simulator files, etc.

I've isolated it to it being the Source Control functionality in XCode. The high CPU usage doesn't seem to happen when the affected Project is not open, (Close everything and start a new Xcode project). I've disabled Source Control within XCode and and started using GitX instead, and CPU levels for XCode has dropped back to normal levels (5 - 15%).

I haven't dug deeper into XCode to see what could have triggered it.

tonytastic
  • 176
  • 1
  • 4
4

I was running at 120% - beachball almost constantly - while idle.

What dropped me down to 1.3% was unchecking "Refresh local status automatically" in the "Source Control" tab in Xcode Preferences.

You can still have "Enable Source Control" and "Refresh Server Status Automatically" and "Add and remove files automatically"

Roy Lovejoy
  • 141
  • 6
0

I've submitted a couple bug reports regarding this and while debugging it we came to a conclusion it seems to happen with upgraded projects. By simply removing all the classes from my project then reading them I no longer experience the horrible cpu usage and ram usage. This was primarily happening on 5.0 with my storyboards prior to simply removing them and re-adding them to the project. Xcode 5.0.1 also helped my performance.

*UPDATE Since updating to Xcode 5.0.2 I no longer see these issues. I can finally work on large storyboards again.

Mark McCorkle
  • 9,349
  • 2
  • 32
  • 42
  • Just to clarify, you removed all of your files from the project but kept them on disk. Then you readded all the files back into the project? – Andrew Kozlik Oct 17 '13 at 19:30
  • Correct. Simply adding the files back into the project for some reason has made these projects "usable" again. One would think that clearing the derivedData folder can achieve the same results although this wasn't the case with my project. Create a new project and copy over your classes and see if the new project has the same issue. – Mark McCorkle Oct 18 '13 at 13:26
  • Before I do this, any tips for keeping my project directory structure? My files are pretty organized and I'd hate to go through re-organizing them if I can avoid it. Otherwise no big deal. Thanks for the guidance. – Andrew Kozlik Oct 18 '13 at 14:57
  • Simply zip the project (or make a copy) prior to doing this. – Mark McCorkle Oct 18 '13 at 15:38
  • @AndrewKozlik Xcode for whatever reason doesn't make the project structure match the disk structure. Because of this I never use the groups option in xcode instead I will organize it in finder make folders, etc, then just add those folders to xcode so my disk structure matches project structure. Then rebuilding the structure from disk becomes painless. – odyth Oct 23 '13 at 22:12
  • @AndrewKozlik just wanted to know if this fixed the problem. For me I have a huge code base which I got transitioned from a 3rd party and the structure not well maintained, so before I try to do this tideous task I just wanted to know if this works :) – anoop4real Nov 12 '13 at 06:54
0

I have actually figured out the cause of this memory issue in the source that I have, it was because one of the 3rd party library used was giving a lot of warnings and may be xcode is trying to do some processing around that. Just for test purpose, I removed the library and some of the classes which used that, and I was able to build the code faster. Now I plan to get to the bottom of the warnings and try to fix it. Not sure if all the people facing these issue is because of this but this was definitely the reason for my problem.

anoop4real
  • 7,598
  • 4
  • 53
  • 56
0

Did you try to access many libraries at the same time or did you run a search trough out the system regarding a Xcode file or a project?This could sometimes bring the issue you have.running so many functions in xcode at the same time can bring these type of problems.if you can reinstall xcode after taking a backup of the data you need.

Charana STR
  • 69
  • 1
  • 2
  • 9
0

I just experienced similar issues with xcode after an update yesterday.

My memory on a 16GB macbook pro just dried out every time I opened xcode from 11-12gb of free ram to somewhere between 3-4gb with or without any projects open. I tried deleting the DerivedData folder to no avail.

The only solution that I have found that fixes the issue temporarily is for me to let xcode eat all the memory after starting and then doing a sudo purge in terminal.

After the purge I can work as normal with xcode with any projects using only as much ram as it needs to, but this needs to be done every time I start xcode.

Nick Udell
  • 2,420
  • 5
  • 44
  • 83
Sam Bavi
  • 1
  • 1