SetProcessWorkingSetSizeEx() is not working on Windows Server 2022 - x64 OS.

Arjun Annam 1 Reputation point
2022-09-12T11:41:21.677+00:00

We are planning to test and use SetProcessWorkingSetSizeEx() for setting limit on memory (working set) consumed by a service so that working set by our service never exceeds the limit set in dwMaximumWorkingSetSize parameter of this API. We are calling the API with QUOTA_LIMITS_HARDWS_MAX_ENABLE.

We are aware of the impact of this on System's performance when the limit is exceeds as there can be a lot of page faults though the memory is available, depending the on multiple factors. We are in the process of evaluating this, for evaluating we are setting 1/10th of Physical Memory Bytes as limit.

We tested this API on Windows Server 10 - x64, Windows Server 2019 - x64. The API returns success and the working set of our process never exceeds the limit.

And on Windows Server 2022 - x64, the API returns success but the limit is not honored by the OS. The working set by our process exceeds the limit.

As per the documentation of this API, minimum supported OS are

Minimum supported client      Windows Vista [desktop apps | UWP apps]
Minimum supported server      Windows Server 2003 [desktop apps

https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-setprocessworkingsetsizeex

Could anyone please help us on this, if anyone using this API? If there is any change in the behavior of this API on Windows Server 2022 OS.

If more details needed for understanding the issue, let me know. I am happy to share more details.

If this is not the correct forum could you please let me know the right forum in which I would get info?

Regards,
Arjun Annam

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,942 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,587 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,690 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.