Java file limit on OSX lower than in bash Java file limit on OSX lower than in bash elasticsearch elasticsearch

Java file limit on OSX lower than in bash


Java Virtual Machine Option Reference for Mac

-XX:- MaxFDLimit

Directs the VM to refrain from setting the file descriptor limit to the default maximum. The default behavior is to set the limit to the value specified by OPEN_MAX, which is 10240. Normally, this is the maximum number of files that a process may have open. It is possible, however, to increase this limit to a user-specified value with the sysctl utility. Under such circumstances, you may want to pass -XX:-MaxFDLimit to stop the Java VM from restricting the number of open files to 10240.


In the bash script, you don't open files, you just create them, and get rid of the reference to them afterwards. In the Java version, it seems like you keep a reference to it, hence the number of open files. Btw, I now realize that this doesn't really answer the fact why Java can only have 10.000 (+files for the VM), instead of 100.000...