Platform SDK: DLLs, Processes, and Threads

GetProcessWorkingSetSize

The GetProcessWorkingSetSize function retrieves the minimum and maximum working set sizes of the 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 a process' working set is specified in bytes. The minimum and maximum working set sizes affect the virtual memory paging behavior of a process.

BOOL GetProcessWorkingSetSize(
  HANDLE hProcess,                 // handle to the process
  PSIZE_T lpMinimumWorkingSetSize, // minimum working set size
  PSIZE_T lpMaximumWorkingSetSize  // maximum working set size
);

Parameters

hProcess
[in] Handle to the process whose working set sizes will be obtained. The handle must have the PROCESS_QUERY_INFORMATION access right. For more information, see Process Security and Access Rights.
lpMinimumWorkingSetSize
[out] Pointer to a variable that receives the minimum working set size of the specified process. The virtual memory manager attempts to keep at least this much memory resident in the process whenever the process is active.
lpMaximumWorkingSetSize
[out] Pointer to a variable that receives the maximum working set size of the specified process. The virtual memory manager attempts to keep no more than this much memory resident in the process whenever the process is active when memory is in short supply.

Return Values

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.

Requirements

  Windows NT/2000: Requires Windows NT 3.5 or later.
  Windows 95/98: Unsupported.
  Header: Declared in Winbase.h; include Windows.h.
  Library: Use Kernel32.lib.

See Also

Processes and Threads Overview, Process and Thread Functions, SetProcessWorkingSetSize