Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Max open files per process

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

like image 746
Dmitry Avatar asked Jan 19 '23 06:01

Dmitry


1 Answers

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.

like image 144
Dmitry Avatar answered Jan 24 '23 17:01

Dmitry