Process Memory Counter is defined structure available in the psapi (Process Status API). Its structure is defined as,
typedef struct _PROCESS_MEMORY_COUNTERS {
DWORD cb;
DWORD PageFaultCount;
SIZE_T PeakWorkingSetSize;
SIZE_T WorkingSetSize;
SIZE_T QuotaPeakPagedPoolUsage;
SIZE_T QuotaPagedPoolUsage;
SIZE_T QuotaPeakNonPagedPoolUsage;
SIZE_T QuotaNonPagedPoolUsage;
SIZE_T PagefileUsage;
SIZE_T PeakPagefileUsage;
} PROCESS_MEMORY_COUNTERS;
I use GetProcessMemoryInfo method which has the syntax,
BOOL GetProcessMemoryInfo(HANDLE Process, PROCESS_MEMORY_COUNTERS* pmc,DWORD size_pmc);
From the struct variable pointer pmc I can access the WorkingSetSize of a process (say mspaint.exe) as pmc.WorkingSetSize.
But the memory value displayed in the task manager is not the same as any of the values in the structre. My Questions are,
- What are these values?
- What is the value displayed in the task manager?
- What is the programmatic way to get the memory used as displayed in the task manager?
- Can it be calculated using the process memory counter itself?
PS: The preferred language is C++ and I want to do it without running any commands in the command prompt.