views:

17

answers:

1

Guys, I am using GetProcessMemoryInfo function to get the details of a current process in Visual Studio 2008 running on Windows 7. The output is populated in PROCESS_MEMORY_COUNTERS structure with a list of following members.

  • cb
  • PageFaultCount
  • PeakWorkingSetSize
  • WorkingSetSize
  • QuotaPeakPagedPoolUsage
  • QuotaPagedPoolUsage
  • QuotaPeakNonPagedPoolUsage
  • QuotaNonPagedPoolUsage
  • PagefileUsage
  • PeakPagefileUsage

Which one of these members should I use to get the RAM usage of the process? Is there another way to get the memory usage of a process using Microsoft Visual C++?

+1  A: 

Use WorkingSetSize to retrieve physical RAM usage per process. Per the MSDN docs for the underlying Win32 API:

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.

There is no other way to get the current working set size than what you are using. See here for details.

Steve Townsend