Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode indexing takes ages and uses gigabytes of memory

I have a small project that takes ages to get indexed and uses ridiculous amounts of memory while indexing. In the screenshot you can see two Swift processes using 160+ GB of memory. I have this problem only in one project. btw the project uses CocoaPods.

Now if I keep an eye on the Activity monitor and keep kill the processes in time (before they take up too much memory to freeze the Mac), eventually the project is indexed and I can work on it.

What could be the cause of this memory behavior and how can I prevent it?

[Xcode Version 11.2.1 (11B500) on Catalina 10.15.1 (19B88), CocoaPods 1.8.4]

P.S. Doing the usual clean and delete derived data doesn't help at all.

ridiculous

like image 497
Tycho Pandelaar Avatar asked Nov 15 '19 09:11

Tycho Pandelaar


People also ask

Why does Xcode use so much memory?

For each OS, it has simulator runtimes, libraries, compilers, and software development kits. It has a ton of data about declarations supported in each operating system. That's why it's so huge.

How do I force indexing in Xcode?

While Xcode is open, you can rename the folder that your project is in. Just tweak it with an extra space or something, and when you get the message to close or resave. Just close the project and open it again. Xcode will then index the project.

What is swift frontend process?

The frontend is the part of the Swift executable that actually compiles things. This is as opposed to the driver, which looks at the set of input files and figures out what work (including frontend jobs, but also linkers and other tools) is needed to build the project.


Video Answer


1 Answers

Found it !!

I needed to remove use_frameworks! from my Podfile (make sure you use cocoapods > 1.5.0) and add

install! 'cocoapods', :disable_input_output_paths => true

Source: https://www.ralfebert.de/ios/blog/cocoapods-clean-input-output-files/

like image 101
Tycho Pandelaar Avatar answered Nov 16 '22 03:11

Tycho Pandelaar