mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 00:11:24 +12:00
Make memory locking optional (mlock, VirtualLock).
Fix desired locking operation (to fix "sudo" memory). It was discovered that some systems have outdated configuration. With too tight limit, it's almost impossible to lock anything in memory.
This commit is contained in:
parent
dcbe8ef5f4
commit
d1ee7c651f
4 changed files with 20 additions and 7 deletions
|
@ -292,7 +292,7 @@ int main(int argc, char** argv)
|
|||
#ifdef _WIN32
|
||||
ULONG64 intro_cycles{};
|
||||
QueryThreadCycleTime(GetCurrentThread(), &intro_cycles);
|
||||
verify("SetProcessWorkingSetSize" HERE), SetProcessWorkingSetSize(GetCurrentProcess(), 0x60000000, 0x80000000); // 2GiB
|
||||
SetProcessWorkingSetSize(GetCurrentProcess(), 0x60000000, 0x80000000); // 2GiB
|
||||
#elif defined(RUSAGE_THREAD)
|
||||
struct ::rusage intro_stats{};
|
||||
::getrusage(RUSAGE_THREAD, &intro_stats);
|
||||
|
@ -413,8 +413,17 @@ int main(int argc, char** argv)
|
|||
struct ::rlimit rlim;
|
||||
rlim.rlim_cur = 4096;
|
||||
rlim.rlim_max = 4096;
|
||||
#ifdef RLIMIT_NOFILE
|
||||
if (::setrlimit(RLIMIT_NOFILE, &rlim) != 0)
|
||||
std::fprintf(stderr, "Failed to set max open file limit (4096).");
|
||||
std::fprintf(stderr, "Failed to set max open file limit (4096).\n");
|
||||
#endif
|
||||
|
||||
rlim.rlim_cur = 0x80000000;
|
||||
rlim.rlim_max = 0x80000000;
|
||||
#ifdef RLIMIT_MEMLOCK
|
||||
if (::setrlimit(RLIMIT_MEMLOCK, &rlim) != 0)
|
||||
std::fprintf(stderr, "Failed to set RLIMIT_MEMLOCK size to 2 GiB. Try to update your system configuration.\n");
|
||||
#endif
|
||||
// Work around crash on startup on KDE: https://bugs.kde.org/show_bug.cgi?id=401637
|
||||
setenv( "KDE_DEBUG", "1", 0 );
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue