diff options
| author | yvonne <github.inori@etake.nl> | 2026-10-29 21:14:59 +0100 |
|---|---|---|
| committer | yvonne <github.inori@etake.nl> | 2026-10-29 21:14:59 +0100 |
| commit | 467ec722581e7ad573491c5662bcd9544eadd2ed (patch) | |
| tree | 2641d351dd392f6dfc014ff9c1d96b8642d28187 /src/yuzu/main.cpp | |
| parent | a8657997e1eb594ffde9e28d44672ef5b697ad59 (diff) | |
vfs: keep the open-file cache below RLIMIT_NOFILE on Unix
The VFS cache allowed up to 8192 open files on Unix, and main() set the
soft RLIMIT_NOFILE to exactly 8192. With large loose romfs dumps (e.g.
~205k files) the cache could exhaust every descriptor, so unrelated
opens failed with EMFILE and games crashed on the failed loads.
Size the cache from the actual soft limit with 512 descriptors spare,
as is already done on Windows, and only raise the limit in main()
instead of also lowering higher limits down to 8192.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/yuzu/main.cpp')
| -rw-r--r-- | src/yuzu/main.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index e8c93d451f..c7616e0151 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -122,10 +122,10 @@ int main(int argc, char* argv[]) { _setmaxstdio(8192); #endif // __MSVCRT__ #elif defined(__unix__) || defined(__APPLE__) - // Set the max open file limit to 8192, or the hard limit. + // Raise the open file limit to at least 8192, or the hard limit. // Most sane systems should not hit the hard limit here. struct rlimit rl; - if (getrlimit(RLIMIT_NOFILE, &rl) == 0) { + if (getrlimit(RLIMIT_NOFILE, &rl) == 0 && rl.rlim_cur < 8192) { rl.rlim_cur = std::min<rlim_t>(8192, rl.rlim_max); setrlimit(RLIMIT_NOFILE, &rl); } |
