Browse Source

Avoid integer overflow when calculating working set size

adaptive-webui-19844
Vladimir Golovnev 3 years ago committed by GitHub
parent
commit
c029122a8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/app/application.cpp

2
src/app/application.cpp

@ -799,7 +799,7 @@ void Application::shutdownCleanup(QSessionManager &manager) @@ -799,7 +799,7 @@ void Application::shutdownCleanup(QSessionManager &manager)
#ifdef Q_OS_WIN
void Application::applyMemoryWorkingSetLimit()
{
const int UNIT_SIZE = 1024 * 1024; // MiB
const SIZE_T UNIT_SIZE = 1024 * 1024; // MiB
const SIZE_T maxSize = memoryWorkingSetLimit() * UNIT_SIZE;
const SIZE_T minSize = std::min<SIZE_T>((64 * UNIT_SIZE), (maxSize / 2));
if (!::SetProcessWorkingSetSizeEx(::GetCurrentProcess(), minSize, maxSize, QUOTA_LIMITS_HARDWS_MAX_ENABLE))

Loading…
Cancel
Save