Click to Rate and Give Feedback
MSDN
MSDN Library
System Services
PSAPI Reference
PSAPI Functions
 GetProcessMemoryInfo Function
GetProcessMemoryInfo Function

Retrieves information about the memory usage of the specified process.

Syntax

BOOL WINAPI GetProcessMemoryInfo(
  __in   HANDLE Process,
  __out  PPROCESS_MEMORY_COUNTERS ppsmemCounters,
  __in   DWORD cb
);

Parameters

Process [in]

A handle to the process. The handle must have the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right and the PROCESS_VM_READ access right. For more information, see Process Security and Access Rights.

Windows Server 2003 and Windows XP/2000:  The handle must have the PROCESS_QUERY_INFORMATION and PROCESS_VM_READ access rights.
ppsmemCounters [out]

A pointer to the PROCESS_MEMORY_COUNTERS or PROCESS_MEMORY_COUNTERS_EX structure that receives information about the memory usage of the process.

cb [in]

The size of the ppsmemCounters structure, in bytes.

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.

Examples

For an example, see Collecting Memory Usage Information for a Process.

Requirements

Client Requires Windows Vista, Windows XP, or Windows 2000 Professional.
Server Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
Header

Declared in Psapi.h.

Library

Use Psapi.lib.

DLL

Requires Psapi.dll.

See Also

EnumProcesses
Memory Performance Information
PROCESS_MEMORY_COUNTERS
PROCESS_MEMORY_COUNTERS_EX
Process Memory Usage Information
PSAPI Functions


Send comments about this topic to Microsoft

Build date: 8/7/2008

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker