Fix crash when max files open limit is too small on macOS/iOS
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user