fix reset of open file limit on OS X, where setrlimit() incompatibility left the user with their default open file limit.

This number was frequently too small for even medium-sized sessions, causing the code to open/close files
via an LRU cache, and doing this during capture for audio files caused a massive decrease in the
effective throughput of the system.
This commit is contained in:
Paul Davis 2014-12-10 16:11:30 -05:00
parent bf938eb1d6
commit 2a8049e039

View file

@ -215,7 +215,12 @@ lotsa_files_please ()
if (getrlimit (RLIMIT_NOFILE, &rl) == 0) {
rl.rlim_cur = rl.rlim_max;
#ifdef __APPLE__
/* See the COMPATIBILITY note on the Apple setrlimit() man page */
rl.rlim_cur = min ((rlim_t) OPEN_MAX, rl.rlim_max);
#else
rl.rlim_cur = rl.rlim_max;
#endif
if (setrlimit (RLIMIT_NOFILE, &rl) != 0) {
if (rl.rlim_cur == RLIM_INFINITY) {