Xcode使用大内存,占用ram中的所有内存 [英] Xcode uses big memory, eats all memory in ram

查看:776
本文介绍了Xcode使用大内存,占用ram中的所有内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac上使用Xcode,它的RAM为8GB.当我打开Xcode并且不打开任何项目并等待大约2分钟时,Xcode占用了ram中的所有内存(4GB,5GB ...)

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?

推荐答案

我也已经调查了一段时间.我认为一种解决方案(我需要向用户 justin 致谢)是为Xcode设置多个配置值.当然应该在退出Xcode之后完成.

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

这将防止建立索引并减少编译任务的数量.这使我的Xcode可以留出一些RAM来实际执行一些工作.

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

如上所述,这在此外,清理Xcode缓存可以降低RAM吞噬的速度. (在〜/Library/Developer/Xcode/DerivedData中-它在您的主目录中,并且也可能是隐藏的,因此更易于通过Terminal进行访问.)

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

编辑/更新:

显然,这有助于解决内存问题(尽管仍然需要定期重新启动Xcode).但是,您失去了一些不错的功能:即时错误检查,将IBOutlet拖放到控制器标头中(需要使用旧方法-键入然后连接),可能还有一些其他有用的功能,带有索引.所以要注意.

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.

这篇关于Xcode使用大内存,占用ram中的所有内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆