infinity
infinity

Reputation: 1920

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.

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++?

Upvotes: 1

Views: 1783

Answers (1)

Steve Townsend
Steve Townsend

Reputation: 54168

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.

Upvotes: 1

Related Questions