Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode uses big memory, eats all memory in ram [closed]

Tags:

I use Xcode on my mac, which has 8GB ram. When I open Xcode and don`t open any project and wait about 2 minutes, Xcode eats all the memory in ram, (4GB, 5GB...)

Can anybody tell me why and how to fix this?

like image 940
user1651186 Avatar asked Sep 06 '12 07:09

user1651186


2 Answers

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).

Edit/Update:

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.

like image 109
Ole Avatar answered Sep 19 '22 16:09

Ole


found a temporary solution here

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

like image 33
Irina Avatar answered Sep 21 '22 16:09

Irina