It is a couple of day that my xcode started to index continuously. It's really annoying because the UI locks for seconds while i'm writing. I'm going mad.
I didn't change any specific build settings. I can't recall no change that could be the cause of the problem
My project as 130 classes. I'm using cocoapods and my pod file contains 20 pods.
I tried to reboot xcode and clean up the project without notice no improvements.
I have a macbook pro with SSD disk. 8GB of RAM
The indexing is slow when the system is not using swap memory and the cpu is 20-30% used.
Any ideas?
Related
My xCode 8 keeps freezing at startup when loading the index of the project. I have to delete the derived folder data everytime to make XCode not freezing (and thus it has to rebuild the index everytime). I always had this problem since XCode8 has released and there has not been a fix yet. The problem did not exist when I use XCode7 (even though indexing was also very slow, it did not freeze and will eventually finish).
I suspect that loading the index may take too much memory (my dev machine has 8GB of RAM). Does anyone notice the same problem and is there a solution for it?
Our company's project is decently large (around 200-300 source files).
My XCode is the AppStore public version: Version 8.0 (8A218a).
cd ~/Library/Developer/Xcode/DerivedData/ProjectName-xxxxxxxxxxxxxxxxxxx/
rm -f Index
I run into this issue, and my solution is:
Restart my Xcode, then there is no Loading index...
I'm using XCode 7.0 with iOS 9.0 SDK & ARC, all profiling/testing done on an iPhone 5S with iOS 9. EDIT: for all screenshots, it was a single run: I ran a debug build straight from xcode, and then manually attached Instruments to it. So the screenshots are all from the exact same single test run. This memory growth (per xcode view) is 100% reproducible.
My app downloads ZIP files, unpacks them, and adds them to the camera roll. I've made sure to profile and catch memory leaks (ie. missing CGContextRelease) as well as using #autoreleasepool etc
During unzipping, in xcode I see the memory usage shooting up fast, never-ending until the unzipping finishes, and I cannot explain this because there are no objects in Instruments that I can see being held onto. The memory is never released (per xcode's memory view). At the end of my test run I see 236MB used, with no memory warnings during unzipping. If I use Instruments' allocation tool, I see 50.2MB of heap and anonymous VM used. That's a huge difference!
The first thing I did was assume that [UIImage imageNamed:was to blame (caching etc) because I have quite a few animated UIImageViews, so I spent time removing all imageNamed from my code, and using imageWithContentsOfFile instead. That didn't help at all. I add the unzipped images to the camera roll with iOS 8 Photo framework like this: [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:[NSURL fileURLWithPath:filePath]]
I've spent considerable time pouring through Instruments and web articles but to no avail. Can anyone answer these questions?
Why the discrepancy between xcode memory usage & Instruments -- is this normal?
I assume that these numbers are too high for releasing such an app, and I have to improve this before I upload to app store, right?
Looking at the screenshots below can you make any suggestions where I could start looking for the problem(s)?
Thank you very much in advance for your help. Of course i'll post any source-code that would help, i'm just not sure where to begin...
XCODE MEMORY USAGE 236 MB
INSTRUMENTS
The most common cause of this is your configuration. By default when you run in Xcode, you build in Debug mode. When you profile in Instruments, by default, it builds Release. You can modify your Run and Profile configurations in your scheme to change this.
I use both Xcode 4.6 and Xcode 5.0 for my work. Of late I have observed that it has become very slow. If I open two projects in two windows, switching from one window to another takes way too long. This slowing down is specific to only Xcode as other apps run just fine.
Any insights into how to fix it?
PS: its not related to derived-data or archives. its slow even after emptying both.
Voila. Its working fine now. I don't see any slow-down while context switching between two Xcode windows or working within Xcode in general.
I found 2 main culprits for Xcode slowing down.
1) IDESubversion plugin. I guess this got added from Xcode4.0 onwards. I turned it off.
Here's how to do it:
/Applications/Xcode.app/Contents/PlugIns/IDESubversion.ideplugin
Rename IDESubversion to something like IDESubversion-disabled. Keep extension unchanged.
CAUTION:Please note that I do not use Xcode provided subversion as it is a real CPU and RAM hog. I use Versions. If you use the Xcode provided subversion control, you should not do this step.
2) Delete project.xcworkspace file. In Finder, right-click on YourProjectName.xcodeproj
Select "Show Package Contents" and delete project.xcworkspace.
After doing these two things, my Xcode runs just fine. No slowdown whatever.
PS: RAM is not the root cause in everything that causes a computer to slow down (since most comments suggest that). Even in Xcode3, the in-built subversion used to be a CPU hog to the point of being a nuisance.
Credits:
I found this link helpful in coming to above conclusion:
Link 1
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.
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.
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.
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"
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.
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.
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.
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.
I've been trying to use Xcode 4 on my 1GB Mac Mini. It's not a happy situation. It frequently slows way down, presumably due to memory shortages.
Are there any settings I can change so it won't be such a memory hog?
Another post here suggests that the problem may be having the "predictive compilation turned on in the Xcode preferences."
I ended up doing the following. None of them reduced Xcode's memory consumption, but they did reduce the memory needed by other programs, and hence solved my problem -- speed is fine now.
Start using chrome instead of Firefox
Turn off spotlight and dashboard
Don't auto-launch iTunes