Xcode 8 Stuck at Indexing and uses up all free space in the storage

Hi everyone, I am Unreal C++ Developer and I'm using Xcode as my primary editor for my Unreal projects. Everything was fine with Xcode 7.3.1. Yesterday, I upgraded Xcode from 7.3.1 to 8.0. While opening Unreal Projects in Xcode 8, Xcode freezes at Indexing and also free space on Macintosh SSD is used up drastically by Xcode or whatever(I don't know since the SSD space is completely used up I can't even close any running applications. It just freezes). I tried,


  • Deleting everything in "Derived Cache/" folder and rebooting Mac
  • Re generating Xcode project from Unreal Editor
  • Emptying out build folder and started rebuilding from scratch.
  • Re installing Xcode 8


But nothing seems to work out. Any help would be appreciated.


My Mac Specs are,


System Version: macOS 10.12 (16A323)

Kernel Version: Darwin 16.0.0

MacBook Pro (Retina, 15-inch, Late 2013)

Processor 2 GHz Intel Core i7

Memory 8 GB 1600 MHz DDR3

Accepted Reply

Finally Xcode 8.1 fixed the problem.

Replies

I am in the same boat.

MacBook Pro Mid 2014 16G ram

Indexing keeps going until it uses up all the Application Memory.


I get a pop up that say's out of Application Memory Please Close something.

The only thing i'm running is Xcode and Finder.

and it won't tur off finder.

I have exactly the same thing, only with a Mac Pro ( 32GB ram ).


I can reproduce after only starting JUST Xcode and loading my Unreal Project nothing else.


Xcode eats up to about 64GB of memory and about 25% of the disk before the low memory warning kicks in for me.

How big are your programs?


Are you using cocoa pods? or Firebase?


I need to get this working and I want to find out what we have in common.


I don't feel apple will get back to us in a timely manner.


The last time i needed help it was 6 months before they closed my request saying it was a duplicate of another one that I could not find.


I never got it fixed and had to spend two months rewriting my code.

Same thing sryan. Xcode 8 behaves same as you are experiencing. And we don't use any external plugins and It is only specific to Unreal Projects alone. Other Swift/Objective C projects runs normally!

This is definitely a bug of Xcode indexing service. I've also encountered it after upgrading to Xcode 8.0. It seems indexing service has a serious problem with initializing arrays and dictionaries. I've fixed this by removing initialization and adding each element to the array with arrayName.appand()


Check this out:

http://stackoverflow.com/questions/39547197/xcode-8-0-swift-3-0-slow-indexing-and-building

One of my projects has hit this never-ending indexing issue just recently even though I've been using Xcode 8 since release and updated to Swift 3.0 a few weeks ago. My project is mid-sized, 90% Swift 3.0 with a little Obj-C and C++.


My project is not an Unreal project.


Is the general consensus that a workaround (I don't think we should call this a "fix") is to *not* use Array literals in your code?


I'm at the point now where Xcode is pretty much unusable with this project and the process is putting my MacBook pro into "airplane mode"... Compile times are also sometimes taking way longer than before.


Replacing all my Array literals could be a big job (not to mention it feels kinda wrong...) so I'd like to know if that fixed it for good. Never hit this issue before on Xcode 7.

Just a little update on this in case it helps anyone out...


So, I went through all my Array initialisations last night (boy do I know how to have fun) and cleaned them up, following the pattern of appending instead of literals / inline. I also cleaned-up some really dubious stuff along the lines of:


var ints: [Int] = [] -> var ints = [Int]()


Not sure how stuff like that got in there :-/


Could be totally unrelated, but during my Swift 3.0 conversion, many instance vars and methods were converted to fileprivates so at the time, I just rolled with that. I've since converted all of those to private declarations, as they were originally intended to be.


And clean build, cleared Derived Cache, reboot and...


This seems to have helped in so much as while indexing is still taking a while, it does actually complete now and doesn't seem to hog CPU anything like as much. It's also quite possible that I've just stirred up the soup enough that I've managed to get out of some edge case that was causing the problem - who knows.


If you were banging your head against a wall as I was, give this a go, it might just work.

Same problem here. It has nothing to do with Unity, Unreal or any other framework. It's a global XCode problem.

The problem, as music4sport mentioned, has to do with arrays. I created a sample project to ilustrate the problem here:

https://github.com/DigitalLeaves/XCodeStuckAtIndexing


A simple array of 15-16 elements make this happens (in this case, those are UIButtons):

fileprivate func updateButtonsAppearance() {
  for button in [buttonKey0, buttonKey1, buttonKey2, buttonKey3, buttonKey4, buttonKey5, buttonKey6, buttonKey7, buttonKey8, buttonKey9, buttonKeyLeftParenthesis, buttonKeyRightParenthesis, buttonKeyPoint, buttonKeyComma, buttonKeyHyphen] {
     button?.setTitleColor(normalFontColor, for: .normal)
     button?.setTitleColor(pressedFontColor, for: [.selected, .highlighted])
     button?.setBackgroundImage(normalBackgroundImage, for: .normal)
     button?.setBackgroundImage(pressedBackgroundImage, for: [.selected, .highlighted]) }
   }
}

Finally Xcode 8.1 fixed the problem.

No, it doesn't. Well, I mean, probably in your case it does, but not generally speaking. Just download this project and try to build it with XCode 8.1:

https://github.com/DigitalLeaves/XCodeStuckAtIndexing


As you might see, the problem's still there. I'm glad that yours was solved, however 🙂

me too Digital Leaves

I can't build it with Xcode8.1😢

update:


Xcode version 8.2.1 and this **** is still happening 😠

We are still having this problem as well. XCode memory usage bloats to 45GB and freezes when using C++ arrays as pointed out earlier. This happens during the 'Indexing | Processing files' stage. How can this bug still be here after 2 minor releases and what 6 months now?

I'm still having the problem in Xcode 8.3.2 (8E2002).


Same problem with XCode 9 beta.

Can work on project with any testing devices that has greather ios than 10.2.

Apple please fix this problem.😢

I can't do my job properly.