Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
791 views
in Technique[技术] by (71.8m points)

performance - Xcode 4.3.2 and 100% CPU constantly in the idle time

My Xcode started to behave very heavily from yesterday when working on medium size project (around 200 source files). Project compiles correctly and runs in both simulator and device. I do not use any 3rd party libraries, except few widely used includes (like JSON or facebook ios sdk).

It constantly uses CPU(s) at full speed, even if it is in idle state (no indexing, no compiling, no editing). The usage of RAM is relatively normal (300-50MB).

My machine uses: Core 2 Duo 3.04Ghz CPU, 8GB of RAM and Vertex OCZ 3 SSD drive.

I have tried every suggested solution found at stackoverflow:

  1. Cleaned project
  2. Cleaned Derived Data in Organizer
  3. Cleaned repositories in Organizer
  4. Cleaned xcodeproject bundle from workspace and userdata files as suggested here: https://stackoverflow.com/a/8165886/229229 (it is helping just for a moment and starts again after minute or so).
  5. Restarted Xcode many times (with the same effect as in 4).
  6. Disabled "Live issues"
  7. even Reinstalled Xcode

Nothing helps. In most cases, Xcode indexes the project for a moment, then comes back to the normal performance, but after a while becomes unusable again. CPU jumps back to 95-100% for both cores, intelligence hangs, etc...

I am attaching screenshots of how the Xcode processes are seen by the Instruments:

enter image description here enter image description here enter image description here enter image description here enter image description here

UPDATE: After a moment of hope that I solved the problem by moving around few

#import "header.h"

statements from headers to the implementation files and exchanging them with forward declarations ... the problem came back again after a while. I am adding the console log. The strange thing is that the logs related to Xcode show up after I quit it, not during the run itsef.

Console logs:

5/11/12 9:27:03.777 AM [0x0-0x45045].com.apple.dt.Xcode: com.apple.dt.instruments.backgroundinstruments: Already loaded
5/11/12 9:27:05.571 AM Xcode: Performance: Please update this scripting addition to supply a value for ThreadSafe for each event handler: "/Library/ScriptingAdditions/SIMBL.osax"
5/11/12 9:27:58.168 AM Xcode: ERROR: Failed to create an alert for ID "enabled" based on defaults: 1
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

What stopped my nightmare was:

  1. Change Always Search User Path to NO in Project build settings (bolded).
  2. Remove -objC flag Other Linker Flags (also bolded setting).

And then delete Derived Data and wait until Xcode reindexes.

I am not sure which of them helped bacause I changed both of them at the same time and I am so behind my schedule I have no time to test it. I will improve this answer when I reproduce the bug and solution in spare time.

However, there is a hint: *Rethink and recheck your project / targets build settings.*

It is highly probable that this strange behavior may be caused by some unfortunate combination of build settings.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...