Removes as many pages as possible from the working set of the specified process.
Syntax
BOOL WINAPI EmptyWorkingSet(
__in HANDLE hProcess
);
Parameters
- hProcess [in]
-
A handle to the process. The handle must have the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right and the PROCESS_SET_QUOTA access right. For more information, see Process Security and Access Rights.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call
GetLastError.
Remarks
You can also empty the working set by calling the SetProcessWorkingSetSize or SetProcessWorkingSetSizeEx function with the dwMinimumWorkingSetSize and dwMaximumWorkingSetSize parameters set to the value (SIZE_T)–1.
Starting with PSAPI version 2 for Windows 7 and Windows Server 2008 R2, this function is defined as K32EmptyWorkingSet in Psapi.h and exported in Kernel32.lib and Kernel32.dll. However, you should always call this function as EmptyWorkingSet. To ensure correct resolution of symbols for programs that will run on earlier versions of Windows, add Psapi.lib to the TARGETLIBS macro and compile the program with –DPSAPI_VERSION=1.
Requirements
| Minimum supported client | Windows 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| Header | Psapi.h |
| Library | Kernel32.lib on Windows 7 and Windows Server 2008 R2, Psapi.lib on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP/2000 |
| DLL | Kernel32.dll on Windows 7 and Windows Server 2008 R2, Psapi.dll on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP/2000 |
See Also
- EnumProcesses
- PSAPI Functions
- SetProcessWorkingSetSize
- Working Set
- Working Set Information
Send comments about this topic to Microsoft
Build date: 7/2/2009