Max open files per process

ぃ、小莉子 提交于 2019-12-03 13:54:33

问题


What is a maximum open files count in Mac OS X (10.6) per process?

ulimit said than 256, sysctl said 10240, but my test program can create 9469 (under gdb), 10252 (without gdb) files..


回答1:


It is clear now.

The ulimit command is build in shell. You can set the maxfiles using ulimit -n command for current shell (and every program which was started from this shell).

10252 files - it was my mistake.. it was 253 max open files when I start my test program from shell (253 + stdin + stdout + stderr = 256).

9469 files - the result of my test program running under Xcode, it seems that Xcode set tha maxfiles before running the program.

ulimit is not system wide setting, thats why to set the system wide value for maxfiles you must use launchctl (the first process in the system, try to 'launchctl limit') or sysctl.

And the answer is 256 files.



来源:https://stackoverflow.com/questions/6624077/max-open-files-per-process

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!