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?
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.
found a temporary solution here
Run that command every once in a while and it helps with my 8GB
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With