Try to set 2-3 GiB working space and show error if it's failed (Windows)

This commit is contained in:
Nekotekina 2020-11-27 14:47:43 +03:00
parent 872655369a
commit 2bee096246

View File

@ -292,7 +292,6 @@ int main(int argc, char** argv)
#ifdef _WIN32
ULONG64 intro_cycles{};
QueryThreadCycleTime(GetCurrentThread(), &intro_cycles);
SetProcessWorkingSetSize(GetCurrentProcess(), 0x60000000, 0x80000000); // 2GiB
#elif defined(RUSAGE_THREAD)
struct ::rusage intro_stats{};
::getrusage(RUSAGE_THREAD, &intro_stats);
@ -358,6 +357,14 @@ int main(int argc, char** argv)
return 1;
}
#ifdef _WIN32
if (!SetProcessWorkingSetSize(GetCurrentProcess(), 0x80000000, 0xC0000000)) // 2-3 GiB
{
report_fatal_error("Not enough memory for RPCS3 process.");
return 2;
}
#endif
std::unique_ptr<logs::listener> log_file;
{
// Check free space