“打开的文件太多”错误 xcode
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32911097/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
'Too many open files' error xcode
提问by James Chen
This is quite odd. I'm not at all sure why I'm getting this error. I deleted the derived data already and I'm not else quite sure where this error is coming from.
这很奇怪。我完全不确定为什么会收到此错误。我已经删除了派生数据,我不太确定这个错误来自哪里。
This is the first time I've seen it. It used to show up when running my simulator and now it's showing up when running on my phone.
这是我第一次看到它。它曾经在运行我的模拟器时出现,现在在我的手机上运行时出现。
采纳答案by Arsen
I think you just have reached the maximum number of open file descriptors.
我认为您刚刚达到了打开文件描述符的最大数量。
You can check the limit by
您可以通过以下方式检查限制
$ ulimit
And change it by:
并通过以下方式更改它:
$ ulimit -n 6666
But do not forget ulimit
changes the limit only for current session. You have to put ulimit -n 6666
to .bash_profile
or something like this
但是不要忘记ulimit
更改仅针对当前会话的限制。你必须把ulimit -n 6666
到.bash_profile
或这样的事情
回答by Adriana Carelli
Check if you have too many open simulators. I closed all the simulators and the error went away
检查您是否有太多打开的模拟器。我关闭了所有模拟器,错误消失了
回答by Daenerys
Check the number of file descriptors that can be opened by your shell. Most cases, default will be 256.
检查您的 shell 可以打开的文件描述符的数量。大多数情况下,默认值为 256。
ulimit -a
ulimit -a
To solve the 'too many open files' issue locally, increase the number of files that can be opened per shell:
要在本地解决“打开文件过多”的问题,请增加每个 shell 可以打开的文件数:
ulimit -S -n 2048 #2048 works fine, or you may put other value.
ulimit -S -n 2048 #2048 works fine, or you may put other value.
In case it still does not resolve, system settings can be checked the following way:
如果还是不能解决,可以通过以下方式检查系统设置:
sysctl kern.maxfiles
sysctl kern.maxfilesperproc
sysctl kern.maxfiles
sysctl kern.maxfilesperproc
If you prefer to increase the limits system wide, go for these:
如果您更喜欢在系统范围内增加限制,请执行以下操作:
sysctl -w kern.maxfiles=20480 (or any number)
sysctl -w kern.maxfilesperproc=18000 (or any number)
sysctl -w kern.maxfiles=20480 (or any number)
sysctl -w kern.maxfilesperproc=18000 (or any number)
Use sudo
at the beginning of the command, in case you get permission denied.
sudo
在命令的开头使用,以防您获得权限被拒绝。
In order to make this a permanent setting, you will need to add it or change default kernal parameters in /etc/sysctl.conf
file.
为了使其成为永久设置,您需要添加它或更改/etc/sysctl.conf
文件中的默认内核参数。
This articleexplains the details.
这篇文章解释了细节。
回答by Pramanshu
Right click on the simulator & press quit after that error will be away.
右键单击模拟器并在错误消失后按退出。