From dc324b4ec69a1fdc94a149ad09bf05f5cae2f797 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 23 Sep 2023 14:47:16 +0200 Subject: [PATCH] Fix crash when max files open limit is too small on macOS/iOS --- Source/Engine/Platform/Apple/ApplePlatform.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/Engine/Platform/Apple/ApplePlatform.cpp b/Source/Engine/Platform/Apple/ApplePlatform.cpp index eeef5b91f..25964ff83 100644 --- a/Source/Engine/Platform/Apple/ApplePlatform.cpp +++ b/Source/Engine/Platform/Apple/ApplePlatform.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -309,6 +310,14 @@ bool ApplePlatform::Init() OnPlatformUserAdd(New(username)); } + // Increase the maximum number of simultaneously open files + { + struct rlimit limit; + limit.rlim_cur = OPEN_MAX; + limit.rlim_max = RLIM_INFINITY; + setrlimit(RLIMIT_NOFILE, &limit); + } + AutoreleasePool = [[NSAutoreleasePool alloc] init]; return false;