Fix crash when max files open limit is too small on macOS/iOS

This commit is contained in:
Wojtek Figat
2023-09-23 14:47:16 +02:00
parent f09aebacad
commit dc324b4ec6

View File

@@ -30,6 +30,7 @@
#include <stdlib.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <mach/mach_time.h>
#include <mach-o/dyld.h>
#include <uuid/uuid.h>
@@ -309,6 +310,14 @@ bool ApplePlatform::Init()
OnPlatformUserAdd(New<User>(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;