本文介绍了SourceKitService消耗CPU并将Xcode研磨成停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这不是Beta问题。我正在使用Xcode 6.0.1,即生产版本。我遇到的问题是,当我尝试构建或运行我正在处理的代码时,Xcode在很长一段时间内都没有响应,并且SourceKitService消耗了超过400%的CPU(根据Activity Monitor)。这个问题在最近几天是新的,但奇怪的是,自从它于9月17日正式发布以来,我一直在使用Xcode 6.0。我升级到6.0.1,希望它能解决这个问题。

This is NOT a Beta issue. I am on Xcode 6.0.1, production release. The issue I am having is that when I try to do a Build or Run the code I am working on, Xcode becomes unresponsive for large periods of time and the SourceKitService consumes upwards of 400% of the CPU (according to Activity Monitor). This issue is new as of the last few days, although, oddly, I had been on Xcode 6.0 since it was officially released on Sept 17. I upgraded to 6.0.1 hoping it would contain a fix for this issue.

有什么问题可以解决?

推荐答案

遇到这个问题今天早些时候使用Xcode 6.1.1(不是beta版,官方发布版)。我一直在Playground上运行一些代码,并怀疑这是原因。 CPU被盯住了近100%,而Xcode无法完成构建。

Ran into this problem with Xcode 6.1.1 earlier this afternoon (not beta, official released version). I had been running some code on Playground and was suspecting that to be the cause. CPU was pegged to nearly 100%, and Xcode was unable to complete builds.

所以这就是我所做的:


1.已打开Activity Monitor,它显示SourceKitService为主要的CPU hog。


2.在Activity Monitor中,双击SourceKitService并单击打开文件和端口部分,显示它是处理特定文件夹的/ Users / myname / Library / Developer / Xcode / DerivedData / ModuleCache /目录下的文件。


3.删除指定的文件夹(从命令行,使用rm -rf)。根据重新生成缓存我可以安全地删除Xcode Derived数据文件夹的内容吗? / a>。


4.再次使用Activity Monitor,强制退出SourceKitServer。在Xcode中看到了现在太熟悉的标志,说SourceKitService崩溃了(这就是为什么SourceKitService听起来很熟悉!)。


5.重复步骤3.

So here's what I did:

1. Opened "Activity Monitor", which showed SourceKitService as the main CPU hog.

2. Within "Activity Monitor", double-clicked on the SourceKitService and clicked on "Open Files and Ports" section, which showed it was working on files under the /Users/myname/Library/Developer/Xcode/DerivedData/ModuleCache/ directory for a specific folder.

3. Deleted the specified folder (from a command-line, using rm -rf). The cache is regenerated based on Can I safely delete contents of Xcode Derived data folder? .

4. Using Activity Monitor again, Force-Quit SourceKitServer. Saw the now-all-too-familiar sign within Xcode saying that SourceKitService had crashed (so that's why SourceKitService sounded familiar!).

5. Repeated step 3.

Mac又是和平的。没有数据丢失,甚至不需要重新启动Xcode(我曾尝试过失败)。底线是ModuleCache似乎在循环中获取SourceKitService并删除该文件夹似乎解决了它。希望这也适合你。

The Mac is peaceful, again. No data was lost and Xcode didn't even have to be restarted (which I had tried unsuccessfully). Bottom line is that ModuleCache seems to be getting SourceKitService in a loop and deleting the folder seems to fix it. Hope this works for you too.

Bootnote:

顺便说一句,SourceKitService问题的原因是我的数组太长了我的Swift课程中的声明。我在一个数组中有200多个条目。将它减少到30并且错误消失了。所以问题可能是由于苹果代码中的某种堆栈溢出(双关语意图)而引起的。

Bootnote:

By the way, the cause for SourceKitService issue was that I had too long an array declaration in my Swift class. I had over 200 entries in an array. Reduced it to 30 and the error went away. So the issue may have arisen due to some kind of stack overflow in apple code (pun intended).

这篇关于SourceKitService消耗CPU并将Xcode研磨成停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!