Xcode uses big memory, eats all memory in ram

6 Solutions Collect From Internet About “Xcode uses big memory, eats all memory in ram”

I have been investigating this issue for some time too. I think one solution (which I need to credit the user justin for) is to set several config values for Xcode. It should be done after quiting the Xcode of course.

In the terminal execute the following commands:

defaults write com.apple.dt.XCode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4

defaults write com.apple.dt.XCode IDEIndexDisable 1

this will prevent indexing and reduce the number of compile tasks. This allowed my Xcode to leave me some RAM for actually doing some work.

to delete these settings, eg indexing:

defaults delete com.apple.dt.XCode IDEIndexDisable

As mentioned, this was discussed in this question.

In addition, cleaning the Xcode cache allowed to reduce the speed that the RAM was eaten with. (at ~/Library/Developer/Xcode/DerivedData – it is at your home dir, and also it is probably hidden, so easier to access with Terminal).


Apparently, this helps with the memory issue (although still need to restart Xcode regularly). However you are loosing some nice-to-haves: instant error checking, control-drag-and-drop IBOutlet adding to the controller header (need to do it the old way – type in and then connect), probably some other helpful features that come with indexing. So be aware.

found a temporary solution here

Run that command every once in a while and it helps with my 8GB

I’m surprised I haven’t read the real answer/problem here although there is no solution. I see you mentioned you don’t even have to open a project but generally the problem occurs when using storyboards. I’ve confirmed this, sent examples to Apple, filed bug reports, waited for new releases, nothing yet. Somewhere down the line there is a leak when editing storyboard views. If you are editing raw code you will never see the ram usage increase but the second you begin editing a storyboard with multiple views and segues the problem arises. I currently run 24GB of ram and it can be consumed in less than an hour when editing views in a storyboard. Like others have mentioned, the only solution is to restart Xcode. Simply closing the project is not good enough.

I faced the same problem, but in correlation to Interface Builder and Storyboard access.

After some thinking, it becomes clear that after Storyboard file in my project enlarged to some amount (currently about 1.5MB on disk), XCode and IB have problem.

While changing text in some (e.g. IBLabel) object, it needs about 0.5 seconds for each letter, what gives 3 seconds for a change of 6 character word. That slows me a lot.

XCode restart helps and releases all occupied memory…until next working session.

I have strong impression that IB makes undo buffer after each change (e.g. change single letter) because after each single change, memory footprint enlarges for about 20 MB (probably Storyboard size in RAM, on disk is 1.5 MB).

And after XCode restart, undo buffer has gone, and some memory has accordingly released.

I would like to know a way to limit undo buffer size, and test it with that smaller size.

Configuration is: Mac Mini, 4 GB RAM, OS X 10.8.3, XCode 4.6, XCode 4.6.1, XCode 4.6.2

I am currently back to XCode 4.5 and situation seems a little bit better but problem is still here. I suppose this version has less features than 4.6 and according that difference it uses less memory.

Ok, seems like XCode 4.5 actually CAN release some of memory that Interface Builder allocates.

Update on May 21. 2013:
I upgraded from 4GB to Mac Mini 2011 8GB RAM and did not notice problem yet.

There’s no real way around that problem.

It’s discussed on many websites. The only solution that helped me with this problem is,
restarting XCode now an then. I don’t think that there will be a real solution for this problem.

XCode is a real memory monster, and if you trying using one of the “instruments” it eats even more. Depending on the tasks some people do not have that many issues, specially if they have more memory.

Personally I started with 2GB and XCode was just… painful

After upgrading to 8GB I just had to restart every now and then

I have heard that people with 16GB do not complain that much, and just have to restart XCode once or two a day.

It looks quite strange to me that you use all your memory after 2 minutes. I might guess that there is some setting of yours that is making all XCode leaks much worst. Have you tried deleting all your ~/Library/Developer folder and setting files?