# Function Reference

# _WinAPI_GetProcessMemoryInfo

Retrieves information about the memory usage of the specified process

#include <WinAPIProc.au3>
_WinAPI_GetProcessMemoryInfo ( [$iPID = 0] )

## Parameters

$iPID | [optional] The PID of the process. Default (0) is the current process.

## Return Value

Success: | The array that contains the following information: [0] - The number of page faults. [1] - The peak working set size, in bytes. [2] - The current working set size, in bytes. [3] - The peak paged pool usage, in bytes. [4] - The current paged pool usage, in bytes. [5] - The peak nonpaged pool usage, in bytes. [6] - The current nonpaged pool usage, in bytes. [7] - The current space allocated for the pagefile, in bytes. [8] - The peak space allocated for the pagefile, in bytes. [9] - The current amount of memory that cannot be shared with other processes, in bytes.
Failure: | Sets the @error flag to non-zero.

## See Also

Search GetProcessMemoryInfo in MSDN Library.

## Example

    #include <WinAPIProc.au3>

    Local $aData = _WinAPI_GetProcessMemoryInfo()

    ConsoleWrite('Number of page faults: ' & $aData[0] & @CRLF)
    ConsoleWrite('Peak working set size: ' & $aData[1] & ' bytes' & @CRLF)
    ConsoleWrite('Current working set size: ' & $aData[2] & ' bytes' & @CRLF)
    ConsoleWrite('Peak paged pool usage: ' & $aData[3] & ' bytes' & @CRLF)
    ConsoleWrite('Current paged pool usage: ' & $aData[4] & ' bytes' & @CRLF)
    ConsoleWrite('Peak nonpaged pool usage: ' & $aData[5] & ' bytes' & @CRLF)
    ConsoleWrite('Current nonpaged pool usage: ' & $aData[6] & ' bytes' & @CRLF)
    ConsoleWrite('Current space allocated for the pagefile: ' & $aData[7] & ' bytes' & @CRLF)
    ConsoleWrite('Peak space allocated for the pagefile: ' & $aData[8] & ' bytes' & @CRLF)
    ConsoleWrite('Current private space: ' & $aData[9] & ' bytes' & @CRLF)