Fixed issue where on windows GetAppRamMax() returned less values than GetAppRamAvailable()

This commit is contained in:
Vladyslav Baranovskyi
2024-06-11 18:44:51 +03:00
parent 91b9da6aa6
commit 938495ab81

View File

@@ -48,13 +48,25 @@ namespace OpenVulkano
{
switch(type)
{
case APP_MEM_TYPE::VM_MAX: return counters.PeakWorkingSetSize;
case APP_MEM_TYPE::VM_MAX: return counters.PeakPagefileUsage;
case APP_MEM_TYPE::USED: return counters.PrivateUsage;
}
}
Logger::PERF->error("Failed to get process memory info");
return 0;
}
size_t GetCommitLimit()
{
MEMORYSTATUSEX status;
status.dwLength = sizeof(status);
if(GlobalMemoryStatusEx(&status))
{
return status.ullTotalPageFile;
}
Logger::PERF->error("Failed to get system commit limit");
return 0;
}
}
size_t SystemInfo::GetSystemRam()
@@ -69,12 +81,12 @@ namespace OpenVulkano
size_t SystemInfo::GetAppRamMax()
{
return std::min(GetSystemRam(), GetAppVirtualMemoryMax());
return std::min(GetSystemRam(), GetCommitLimit());
}
size_t SystemInfo::GetAppRamAvailable()
{
return std::min(GetSystemRamAvailable(), GetAppVirtualMemoryMax() - GetAppRamUsed());
return std::min(GetSystemRamAvailable(), GetCommitLimit() - GetAppRamUsed());
}
size_t SystemInfo::GetAppRamUsed()