Get Process Memory

Category: visual studio vclanguage

Question

LokanathNayak on Thu, 21 Sep 2017 18:41:59


Hi,

I need to get the memory consumption for my process at a given point of time, which normally displays in task manager of window.

I tried using the GetProcessMemoryInfo APIand i collected the PROCESS_MEMORY_COUNTERS. But needtounderstand, how to get the exact/nearly memory of the process display in taskmanager for the process.

Is there any other better way to get.

Thanks

Replies

Baron Bi on Fri, 22 Sep 2017 03:01:11


Hi LokanathNayak,

thanks for posting here.

>>I tried using the GetProcessMemoryInfo APIand i collected the PROCESS_MEMORY_COUNTERS. But needtounderstand, how to get the exact/nearly memory of the process display in taskmanager for the process.

As far as I know,  the WorkingSetSize member of PROCESS_MEMORY_COUNTERS is the closest match to the Mem Usage column in task manager, but it's not going to be exactly the same.

Here is a sample code for you as a reference.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms682050(v=vs.85).aspx

Hope this could be help of you.

Best Regards,
Sera Yu

Baron Bi on Wed, 27 Sep 2017 02:52:11


Hi LokanathNayak,

Has your case been solved? If it has, please help to mark answer. If not, just feel free to contact us.

Your understanding and cooperation will be grateful.

Best Regards,
Sera Yu