开发者

Process RAM Usage in Visual C++

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
  • Work开发者_开发百科ingSetSize
  • 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++?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜