The SetProcessWorkingSetSize function sets the minimum and maximum working set sizes for a specified process.
The working set of a process is the set of memory pages currently visible to the process in physical RAM memory. These pages are resident and available for an application to use without triggering a page fault. The size of the working set of a process is specified in bytes. The minimum and maximum working set sizes affect the virtual memory paging behavior of a process.
BOOL SetProcessWorkingSetSize(
HANDLE hProcess, |
// open handle to the process of interest |
DWORD dwMinimumWorkingSetSize, |
// specifies minimum working set size |
DWORD dwMaximumWorkingSetSize |
// specifies maximum working set size |
); |
Windows NT: The handle must have PROCESS_SET_QUOTA access rights. For
more information, see Process Objects.
If both dwMinimumWorkingSetSize and dwMaximumWorkingSetSize have
the value 0xffffffff, the function temporarily trims the working set of the
specified process to zero. This essentially swaps the process out of physical
RAM memory.
If both dwMinimumWorkingSetSize and dwMaximumWorkingSetSize have the value 0xffffffff, the function temporarily trims the working set of the specified process to zero. This essentially swaps the process out of physical RAM memory.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. Call GetLastError to obtain extended error information.
The working set of the specified process can be emptied by specifying the value 0xffffffff for both the minimum and maximum working set sizes.
If the values of either dwMinimumWorkingSetSize or dwMaximumWorkingSetSize are greater than the process’ current working set sizes, the specified process must have the SE_INC_BASE_PRIORITY_NAME privilege. Users in the Administrators and Power Users groups generally have this privilege. For more information about security privileges, see Privileges.
The operating system allocates working set sizes on a first-come, first-served basis. For example, if an application successfully sets 40 megabytes as its minimum working set size on a 64-megabyte system, and a second application requests a 40-megabyte working set size, the operating system denies the second application’s request.
Using the SetProcessWorkingSetSize function to set an application's minimum and maximum working set sizes does not guarantee that the requested memory will be reserved, or that it will remain resident at all times. When the application is idle, or a low-memory situation causes a demand for memory, the operating system can reduce the application's working set. An application can use the VirtualLock function to lock ranges of the application's virtual address space in memory; however, that can potentially degrade the performance of the system.
When you increase the working set size of an application, you are taking away physical memory from the rest of the system. This can degrade the performance of other applications and the system as a whole. It can also lead to failures of operations that require physical memory to be present; for example, creating processes, threads, and kernel pool. Thus, you must use the SetProcessWorkingSetSize function carefully. You must always consider the performance of the whole system when you are designing an application.
GetProcessWorkingSetSize, VirtualLock
file: /Techref/os/win/api/win32/func/src/f81_3.htm, 5KB, , updated: 2000/4/7 11:19, local time: 2024/11/29 23:26,
18.221.90.184:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/Techref/os/win/api/win32/func/src/f81_3.htm"> SetProcessWorkingSetSize</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.